incomplete.carbon 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868
  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 object of incomplete type `J` [IncompleteTypeInMemberAccess]
  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 object of incomplete type `J` [IncompleteTypeInMemberAccess]
  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. // Not extend, so only required to be identified.
  152. require impls Y;
  153. }
  154. class C {}
  155. impl C as X {}
  156. // --- fail_incomplete_constraint.carbon
  157. library "[[@TEST_NAME]]";
  158. constraint A;
  159. interface B {
  160. // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE+7]]:17: error: facet type `A` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType]
  161. // CHECK:STDERR: require impls A;
  162. // CHECK:STDERR: ^
  163. // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE-6]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere]
  164. // CHECK:STDERR: constraint A;
  165. // CHECK:STDERR: ^~~~~~~~~~~~~
  166. // CHECK:STDERR:
  167. require impls A;
  168. }
  169. // CHECK:STDOUT: --- fail_empty_struct.carbon
  170. // CHECK:STDOUT:
  171. // CHECK:STDOUT: constants {
  172. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  173. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  174. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  175. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
  176. // CHECK:STDOUT: }
  177. // CHECK:STDOUT:
  178. // CHECK:STDOUT: file {
  179. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  180. // CHECK:STDOUT: .I = %I.decl
  181. // CHECK:STDOUT: }
  182. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  183. // CHECK:STDOUT: impl_decl @empty_struct_type.as.I.impl [concrete] {} {
  184. // CHECK:STDOUT: %.loc6_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  185. // CHECK:STDOUT: %.loc6_7.2: type = converted %.loc6_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  186. // CHECK:STDOUT: %I.ref.loc6: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @empty_struct_type.as.I.impl [concrete]
  189. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  190. // CHECK:STDOUT: impl_decl @empty_struct_type.as.I.impl [concrete] {} {
  191. // CHECK:STDOUT: %.loc15_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  192. // CHECK:STDOUT: %.loc15_7.2: type = converted %.loc15_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  193. // CHECK:STDOUT: %I.ref.loc15: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  194. // CHECK:STDOUT: }
  195. // CHECK:STDOUT: }
  196. // CHECK:STDOUT:
  197. // CHECK:STDOUT: interface @I;
  198. // CHECK:STDOUT:
  199. // CHECK:STDOUT: impl @empty_struct_type.as.I.impl: %.loc6_7.2 as %I.ref.loc6 {
  200. // CHECK:STDOUT: !members:
  201. // CHECK:STDOUT: witness = <error>
  202. // CHECK:STDOUT: }
  203. // CHECK:STDOUT:
  204. // CHECK:STDOUT: --- fail_class.carbon
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: constants {
  207. // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete]
  208. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  209. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  210. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  211. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness file.%J.impl_witness_table [concrete]
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: file {
  215. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  216. // CHECK:STDOUT: .J = %J.decl
  217. // CHECK:STDOUT: .C = %C.decl
  218. // CHECK:STDOUT: .I = <poisoned>
  219. // CHECK:STDOUT: }
  220. // CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {}
  221. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  222. // CHECK:STDOUT: impl_decl @C.as.<error>.impl [concrete] {} {
  223. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  224. // CHECK:STDOUT: %I.ref: <error> = name_ref I, <error> [concrete = <error>]
  225. // CHECK:STDOUT: }
  226. // CHECK:STDOUT: impl_decl @C.as.J.impl [concrete] {} {
  227. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  228. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  229. // CHECK:STDOUT: }
  230. // CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (), @C.as.J.impl [concrete]
  231. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness]
  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: !members:
  240. // CHECK:STDOUT: witness = <error>
  241. // CHECK:STDOUT: }
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: class @C {
  244. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  245. // CHECK:STDOUT: complete_type_witness = %complete_type
  246. // CHECK:STDOUT:
  247. // CHECK:STDOUT: !members:
  248. // CHECK:STDOUT: .Self = constants.%C
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: --- fail_class_no_forward_decl.carbon
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: constants {
  254. // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete]
  255. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  256. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  257. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  258. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness file.%J.impl_witness_table [concrete]
  259. // CHECK:STDOUT: }
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: file {
  262. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  263. // CHECK:STDOUT: .J = %J.decl
  264. // CHECK:STDOUT: .C = %C.decl
  265. // CHECK:STDOUT: }
  266. // CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {}
  267. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  268. // CHECK:STDOUT: impl_decl @C.as.J.impl [concrete] {} {
  269. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  270. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  271. // CHECK:STDOUT: }
  272. // CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (), @C.as.J.impl [concrete]
  273. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness]
  274. // CHECK:STDOUT: }
  275. // CHECK:STDOUT:
  276. // CHECK:STDOUT: interface @J;
  277. // CHECK:STDOUT:
  278. // CHECK:STDOUT: impl @C.as.J.impl: %C.ref as %J.ref {
  279. // CHECK:STDOUT: !members:
  280. // CHECK:STDOUT: witness = <error>
  281. // CHECK:STDOUT: }
  282. // CHECK:STDOUT:
  283. // CHECK:STDOUT: class @C {
  284. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  285. // CHECK:STDOUT: complete_type_witness = %complete_type
  286. // CHECK:STDOUT:
  287. // CHECK:STDOUT: !members:
  288. // CHECK:STDOUT: .Self = constants.%C
  289. // CHECK:STDOUT: }
  290. // CHECK:STDOUT:
  291. // CHECK:STDOUT: --- fail_class_with_rewrite.carbon
  292. // CHECK:STDOUT:
  293. // CHECK:STDOUT: constants {
  294. // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete]
  295. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  296. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  297. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  298. // CHECK:STDOUT: %.Self: %J.type = symbolic_binding .Self [symbolic_self]
  299. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  300. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  301. // CHECK:STDOUT: }
  302. // CHECK:STDOUT:
  303. // CHECK:STDOUT: file {
  304. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  305. // CHECK:STDOUT: .J = %J.decl
  306. // CHECK:STDOUT: .C = %C.decl
  307. // CHECK:STDOUT: }
  308. // CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {}
  309. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  310. // CHECK:STDOUT: impl_decl @C.as.<error>.impl [concrete] {} {
  311. // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, file.%C.decl [concrete = constants.%C]
  312. // CHECK:STDOUT: %J.ref.loc13: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  313. // CHECK:STDOUT: %.Self.2: %J.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  314. // CHECK:STDOUT: %.Self.ref.loc13: %J.type = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self]
  315. // CHECK:STDOUT: %.loc13_25: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  316. // CHECK:STDOUT: %.loc13_13: type = where_expr %.Self.2 [concrete = <error>] {
  317. // CHECK:STDOUT: requirement_base_facet_type constants.%J.type
  318. // CHECK:STDOUT: requirement_rewrite <error>, <error>
  319. // CHECK:STDOUT: }
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT: impl_decl @C.as.<error>.impl [concrete] {} {
  322. // CHECK:STDOUT: %C.ref.loc22: type = name_ref C, file.%C.decl [concrete = constants.%C]
  323. // CHECK:STDOUT: %J.ref.loc22: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  324. // CHECK:STDOUT: %.Self.1: %J.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  325. // CHECK:STDOUT: %.Self.ref.loc22: %J.type = name_ref .Self, %.Self.1 [symbolic_self = constants.%.Self]
  326. // CHECK:STDOUT: %.loc22_25: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  327. // CHECK:STDOUT: %.loc22_13: type = where_expr %.Self.1 [concrete = <error>] {
  328. // CHECK:STDOUT: requirement_base_facet_type constants.%J.type
  329. // CHECK:STDOUT: requirement_rewrite <error>, <error>
  330. // CHECK:STDOUT: }
  331. // CHECK:STDOUT: }
  332. // CHECK:STDOUT: }
  333. // CHECK:STDOUT:
  334. // CHECK:STDOUT: interface @J;
  335. // CHECK:STDOUT:
  336. // CHECK:STDOUT: impl @C.as.<error>.impl: %C.ref.loc13 as %.loc13_13 {
  337. // CHECK:STDOUT: !members:
  338. // CHECK:STDOUT: witness = <error>
  339. // CHECK:STDOUT: }
  340. // CHECK:STDOUT:
  341. // CHECK:STDOUT: class @C {
  342. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  343. // CHECK:STDOUT: complete_type_witness = %complete_type
  344. // CHECK:STDOUT:
  345. // CHECK:STDOUT: !members:
  346. // CHECK:STDOUT: .Self = constants.%C
  347. // CHECK:STDOUT: }
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: --- fail_todo_class_with_qualified_rewrite.carbon
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: constants {
  352. // CHECK:STDOUT: %K.type: type = facet_type <@K> [concrete]
  353. // CHECK:STDOUT: %Self: %K.type = symbolic_binding Self, 0 [symbolic]
  354. // CHECK:STDOUT: %K.assoc_type: type = assoc_entity_type @K [concrete]
  355. // CHECK:STDOUT: %assoc0: %K.assoc_type = assoc_entity element0, @K.%X [concrete]
  356. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  357. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  358. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  359. // CHECK:STDOUT: }
  360. // CHECK:STDOUT:
  361. // CHECK:STDOUT: interface @J;
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: interface @K {
  364. // CHECK:STDOUT: %Self: %K.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  365. // CHECK:STDOUT: %X: type = assoc_const_decl @X [concrete] {
  366. // CHECK:STDOUT: %assoc0: %K.assoc_type = assoc_entity element0, @K.%X [concrete = constants.%assoc0]
  367. // CHECK:STDOUT: }
  368. // CHECK:STDOUT:
  369. // CHECK:STDOUT: !members:
  370. // CHECK:STDOUT: .Self = %Self
  371. // CHECK:STDOUT: .X = @X.%assoc0
  372. // CHECK:STDOUT: witness = (%X)
  373. // CHECK:STDOUT:
  374. // CHECK:STDOUT: !requires:
  375. // CHECK:STDOUT: }
  376. // CHECK:STDOUT:
  377. // CHECK:STDOUT: generic assoc_const @X(@K.%Self: %K.type) {
  378. // CHECK:STDOUT: assoc_const X:! type;
  379. // CHECK:STDOUT: }
  380. // CHECK:STDOUT:
  381. // CHECK:STDOUT: class @C {
  382. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  383. // CHECK:STDOUT: complete_type_witness = %complete_type
  384. // CHECK:STDOUT:
  385. // CHECK:STDOUT: !members:
  386. // CHECK:STDOUT: .Self = constants.%C
  387. // CHECK:STDOUT: }
  388. // CHECK:STDOUT:
  389. // CHECK:STDOUT: specific @X(constants.%Self) {}
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: --- incomplete_where.carbon
  392. // CHECK:STDOUT:
  393. // CHECK:STDOUT: constants {
  394. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  395. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  396. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  397. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  398. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic]
  399. // CHECK:STDOUT: %Incomplete.type: type = facet_type <@Incomplete> [concrete]
  400. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self]
  401. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self [symbolic_self]
  402. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where .Self impls @Incomplete> [concrete]
  403. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
  404. // CHECK:STDOUT: }
  405. // CHECK:STDOUT:
  406. // CHECK:STDOUT: file {
  407. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  408. // CHECK:STDOUT: .C = %C.decl
  409. // CHECK:STDOUT: .I = %I.decl
  410. // CHECK:STDOUT: .Incomplete = %Incomplete.decl
  411. // CHECK:STDOUT: }
  412. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  413. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  414. // CHECK:STDOUT: %Incomplete.decl: type = interface_decl @Incomplete [concrete = constants.%Incomplete.type] {} {}
  415. // CHECK:STDOUT: impl_decl @C.as.I.impl [concrete] {} {
  416. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  417. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  418. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  419. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  420. // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%Incomplete.decl [concrete = constants.%Incomplete.type]
  421. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  422. // CHECK:STDOUT: %.loc8_19: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  423. // CHECK:STDOUT: %.loc8_13: type = where_expr %.Self [concrete = constants.%I_where.type] {
  424. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  425. // CHECK:STDOUT: requirement_impls %.loc8_19, %Incomplete.ref
  426. // CHECK:STDOUT: }
  427. // CHECK:STDOUT: }
  428. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @C.as.I.impl [concrete]
  429. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  430. // CHECK:STDOUT: }
  431. // CHECK:STDOUT:
  432. // CHECK:STDOUT: interface @I {
  433. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  434. // CHECK:STDOUT:
  435. // CHECK:STDOUT: !members:
  436. // CHECK:STDOUT: .Self = %Self
  437. // CHECK:STDOUT: witness = ()
  438. // CHECK:STDOUT:
  439. // CHECK:STDOUT: !requires:
  440. // CHECK:STDOUT: }
  441. // CHECK:STDOUT:
  442. // CHECK:STDOUT: interface @Incomplete;
  443. // CHECK:STDOUT:
  444. // CHECK:STDOUT: impl @C.as.I.impl: %C.ref as %.loc8_13 {
  445. // CHECK:STDOUT: !members:
  446. // CHECK:STDOUT: witness = file.%I.impl_witness
  447. // CHECK:STDOUT: }
  448. // CHECK:STDOUT:
  449. // CHECK:STDOUT: class @C {
  450. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  451. // CHECK:STDOUT: complete_type_witness = %complete_type
  452. // CHECK:STDOUT:
  453. // CHECK:STDOUT: !members:
  454. // CHECK:STDOUT: .Self = constants.%C
  455. // CHECK:STDOUT: }
  456. // CHECK:STDOUT:
  457. // CHECK:STDOUT: --- declaration_incomplete_where_rewrite.carbon
  458. // CHECK:STDOUT:
  459. // CHECK:STDOUT: constants {
  460. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  461. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  462. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  463. // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete]
  464. // CHECK:STDOUT: %Self: %J.type = symbolic_binding Self, 0 [symbolic]
  465. // CHECK:STDOUT: %J.assoc_type: type = assoc_entity_type @J [concrete]
  466. // CHECK:STDOUT: %assoc0: %J.assoc_type = assoc_entity element0, @J.%T [concrete]
  467. // CHECK:STDOUT: %Incomplete.type: type = facet_type <@Incomplete> [concrete]
  468. // CHECK:STDOUT: %.Self: %J.type = symbolic_binding .Self [symbolic_self]
  469. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self [symbolic_self]
  470. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  471. // CHECK:STDOUT: %J.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @J [symbolic_self]
  472. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %J.lookup_impl_witness, element0 [symbolic_self]
  473. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  474. // CHECK:STDOUT: %J_where.type: type = facet_type <@J where .Self impls @Incomplete and %impl.elem0 = %empty_tuple.type> [concrete]
  475. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness file.%J.impl_witness_table [concrete]
  476. // CHECK:STDOUT: }
  477. // CHECK:STDOUT:
  478. // CHECK:STDOUT: file {
  479. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  480. // CHECK:STDOUT: .C = %C.decl
  481. // CHECK:STDOUT: .J = %J.decl
  482. // CHECK:STDOUT: .Incomplete = %Incomplete.decl
  483. // CHECK:STDOUT: }
  484. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  485. // CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {}
  486. // CHECK:STDOUT: %Incomplete.decl: type = interface_decl @Incomplete [concrete = constants.%Incomplete.type] {} {}
  487. // CHECK:STDOUT: impl_decl @C.as.J.impl [concrete] {} {
  488. // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, file.%C.decl [concrete = constants.%C]
  489. // CHECK:STDOUT: %J.ref.loc8: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  490. // CHECK:STDOUT: %.Self.2: %J.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  491. // CHECK:STDOUT: %.Self.ref.loc8_19: %J.type = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self]
  492. // CHECK:STDOUT: %Incomplete.ref.loc8: type = name_ref Incomplete, file.%Incomplete.decl [concrete = constants.%Incomplete.type]
  493. // CHECK:STDOUT: %.Self.as_type.loc8_19: type = facet_access_type %.Self.ref.loc8_19 [symbolic_self = constants.%.Self.binding.as_type]
  494. // CHECK:STDOUT: %.loc8_19: type = converted %.Self.ref.loc8_19, %.Self.as_type.loc8_19 [symbolic_self = constants.%.Self.binding.as_type]
  495. // CHECK:STDOUT: %.Self.ref.loc8_46: %J.type = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self]
  496. // CHECK:STDOUT: %T.ref.loc8: %J.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0]
  497. // CHECK:STDOUT: %.Self.as_type.loc8_46: type = facet_access_type %.Self.ref.loc8_46 [symbolic_self = constants.%.Self.binding.as_type]
  498. // CHECK:STDOUT: %.loc8_46: type = converted %.Self.ref.loc8_46, %.Self.as_type.loc8_46 [symbolic_self = constants.%.Self.binding.as_type]
  499. // CHECK:STDOUT: %impl.elem0.loc8: type = impl_witness_access constants.%J.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  500. // CHECK:STDOUT: %.loc8_52.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  501. // CHECK:STDOUT: %.loc8_52.2: type = converted %.loc8_52.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  502. // CHECK:STDOUT: %.loc8_13: type = where_expr %.Self.2 [concrete = constants.%J_where.type] {
  503. // CHECK:STDOUT: requirement_base_facet_type constants.%J.type
  504. // CHECK:STDOUT: requirement_impls %.loc8_19, %Incomplete.ref.loc8
  505. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc8, %.loc8_52.2
  506. // CHECK:STDOUT: }
  507. // CHECK:STDOUT: }
  508. // CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @C.as.J.impl [concrete]
  509. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness]
  510. // CHECK:STDOUT: %impl_witness_assoc_constant: type = impl_witness_assoc_constant constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  511. // CHECK:STDOUT: impl_decl @C.as.J.impl [concrete] {} {
  512. // CHECK:STDOUT: %C.ref.loc10: type = name_ref C, file.%C.decl [concrete = constants.%C]
  513. // CHECK:STDOUT: %J.ref.loc10: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  514. // CHECK:STDOUT: %.Self.1: %J.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  515. // CHECK:STDOUT: %.Self.ref.loc10_19: %J.type = name_ref .Self, %.Self.1 [symbolic_self = constants.%.Self]
  516. // CHECK:STDOUT: %Incomplete.ref.loc10: type = name_ref Incomplete, file.%Incomplete.decl [concrete = constants.%Incomplete.type]
  517. // CHECK:STDOUT: %.Self.as_type.loc10_19: type = facet_access_type %.Self.ref.loc10_19 [symbolic_self = constants.%.Self.binding.as_type]
  518. // CHECK:STDOUT: %.loc10_19: type = converted %.Self.ref.loc10_19, %.Self.as_type.loc10_19 [symbolic_self = constants.%.Self.binding.as_type]
  519. // CHECK:STDOUT: %.Self.ref.loc10_46: %J.type = name_ref .Self, %.Self.1 [symbolic_self = constants.%.Self]
  520. // CHECK:STDOUT: %T.ref.loc10: %J.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0]
  521. // CHECK:STDOUT: %.Self.as_type.loc10_46: type = facet_access_type %.Self.ref.loc10_46 [symbolic_self = constants.%.Self.binding.as_type]
  522. // CHECK:STDOUT: %.loc10_46: type = converted %.Self.ref.loc10_46, %.Self.as_type.loc10_46 [symbolic_self = constants.%.Self.binding.as_type]
  523. // CHECK:STDOUT: %impl.elem0.loc10: type = impl_witness_access constants.%J.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  524. // CHECK:STDOUT: %.loc10_52.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  525. // CHECK:STDOUT: %.loc10_52.2: type = converted %.loc10_52.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  526. // CHECK:STDOUT: %.loc10_13: type = where_expr %.Self.1 [concrete = constants.%J_where.type] {
  527. // CHECK:STDOUT: requirement_base_facet_type constants.%J.type
  528. // CHECK:STDOUT: requirement_impls %.loc10_19, %Incomplete.ref.loc10
  529. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc10, %.loc10_52.2
  530. // CHECK:STDOUT: }
  531. // CHECK:STDOUT: }
  532. // CHECK:STDOUT: }
  533. // CHECK:STDOUT:
  534. // CHECK:STDOUT: interface @J {
  535. // CHECK:STDOUT: %Self: %J.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  536. // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] {
  537. // CHECK:STDOUT: %assoc0: %J.assoc_type = assoc_entity element0, @J.%T [concrete = constants.%assoc0]
  538. // CHECK:STDOUT: }
  539. // CHECK:STDOUT:
  540. // CHECK:STDOUT: !members:
  541. // CHECK:STDOUT: .Self = %Self
  542. // CHECK:STDOUT: .T = @T.%assoc0
  543. // CHECK:STDOUT: witness = (%T)
  544. // CHECK:STDOUT:
  545. // CHECK:STDOUT: !requires:
  546. // CHECK:STDOUT: }
  547. // CHECK:STDOUT:
  548. // CHECK:STDOUT: interface @Incomplete;
  549. // CHECK:STDOUT:
  550. // CHECK:STDOUT: generic assoc_const @T(@J.%Self: %J.type) {
  551. // CHECK:STDOUT: assoc_const T:! type;
  552. // CHECK:STDOUT: }
  553. // CHECK:STDOUT:
  554. // CHECK:STDOUT: impl @C.as.J.impl: %C.ref.loc8 as %.loc8_13 {
  555. // CHECK:STDOUT: !members:
  556. // CHECK:STDOUT: witness = file.%J.impl_witness
  557. // CHECK:STDOUT: }
  558. // CHECK:STDOUT:
  559. // CHECK:STDOUT: class @C {
  560. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  561. // CHECK:STDOUT: complete_type_witness = %complete_type
  562. // CHECK:STDOUT:
  563. // CHECK:STDOUT: !members:
  564. // CHECK:STDOUT: .Self = constants.%C
  565. // CHECK:STDOUT: }
  566. // CHECK:STDOUT:
  567. // CHECK:STDOUT: specific @T(constants.%Self) {}
  568. // CHECK:STDOUT:
  569. // CHECK:STDOUT: specific @T(constants.%.Self) {}
  570. // CHECK:STDOUT:
  571. // CHECK:STDOUT: --- fail_declaration_lookup_into_incomplete.carbon
  572. // CHECK:STDOUT:
  573. // CHECK:STDOUT: constants {
  574. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  575. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  576. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  577. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  578. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic]
  579. // CHECK:STDOUT: %Incomplete.type: type = facet_type <@Incomplete> [concrete]
  580. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self]
  581. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self [symbolic_self]
  582. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where .Self impls @Incomplete> [concrete]
  583. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
  584. // CHECK:STDOUT: %C.as.I.impl.F.type: type = fn_type @C.as.I.impl.F [concrete]
  585. // CHECK:STDOUT: %C.as.I.impl.F: %C.as.I.impl.F.type = struct_value () [concrete]
  586. // CHECK:STDOUT: }
  587. // CHECK:STDOUT:
  588. // CHECK:STDOUT: file {
  589. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  590. // CHECK:STDOUT: .C = %C.decl
  591. // CHECK:STDOUT: .I = %I.decl
  592. // CHECK:STDOUT: .Incomplete = %Incomplete.decl
  593. // CHECK:STDOUT: }
  594. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  595. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  596. // CHECK:STDOUT: %Incomplete.decl: type = interface_decl @Incomplete [concrete = constants.%Incomplete.type] {} {}
  597. // CHECK:STDOUT: impl_decl @C.as.I.impl [concrete] {} {
  598. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  599. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  600. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  601. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  602. // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%Incomplete.decl [concrete = constants.%Incomplete.type]
  603. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  604. // CHECK:STDOUT: %.loc8_19: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  605. // CHECK:STDOUT: %.loc8_13: type = where_expr %.Self [concrete = constants.%I_where.type] {
  606. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  607. // CHECK:STDOUT: requirement_impls %.loc8_19, %Incomplete.ref
  608. // CHECK:STDOUT: }
  609. // CHECK:STDOUT: }
  610. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @C.as.I.impl [concrete]
  611. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  612. // CHECK:STDOUT: }
  613. // CHECK:STDOUT:
  614. // CHECK:STDOUT: interface @I {
  615. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  616. // CHECK:STDOUT:
  617. // CHECK:STDOUT: !members:
  618. // CHECK:STDOUT: .Self = %Self
  619. // CHECK:STDOUT: witness = ()
  620. // CHECK:STDOUT:
  621. // CHECK:STDOUT: !requires:
  622. // CHECK:STDOUT: }
  623. // CHECK:STDOUT:
  624. // CHECK:STDOUT: interface @Incomplete;
  625. // CHECK:STDOUT:
  626. // CHECK:STDOUT: impl @C.as.I.impl: %C.ref as %.loc8_13 {
  627. // 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] {
  628. // CHECK:STDOUT: %return.patt: <error> = return_slot_pattern [concrete]
  629. // CHECK:STDOUT: %return.param_patt: <error> = out_param_pattern %return.patt, call_param0 [concrete]
  630. // CHECK:STDOUT: } {
  631. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @C.as.I.impl.%C.ref [concrete = constants.%C]
  632. // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%Incomplete.decl [concrete = constants.%Incomplete.type]
  633. // CHECK:STDOUT: %T.ref: <error> = name_ref T, <error> [concrete = <error>]
  634. // CHECK:STDOUT: %return.param: ref <error> = out_param call_param0
  635. // CHECK:STDOUT: %return: ref <error> = return_slot %return.param
  636. // CHECK:STDOUT: }
  637. // CHECK:STDOUT:
  638. // CHECK:STDOUT: !members:
  639. // CHECK:STDOUT: .Incomplete = <poisoned>
  640. // CHECK:STDOUT: .F = %C.as.I.impl.F.decl
  641. // CHECK:STDOUT: witness = file.%I.impl_witness
  642. // CHECK:STDOUT: }
  643. // CHECK:STDOUT:
  644. // CHECK:STDOUT: class @C {
  645. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  646. // CHECK:STDOUT: complete_type_witness = %complete_type
  647. // CHECK:STDOUT:
  648. // CHECK:STDOUT: !members:
  649. // CHECK:STDOUT: .Self = constants.%C
  650. // CHECK:STDOUT: }
  651. // CHECK:STDOUT:
  652. // CHECK:STDOUT: fn @C.as.I.impl.F() -> <error>;
  653. // CHECK:STDOUT:
  654. // CHECK:STDOUT: --- fail_unidentified_constraint.carbon
  655. // CHECK:STDOUT:
  656. // CHECK:STDOUT: constants {
  657. // CHECK:STDOUT: %X.type: type = facet_type <@X> [concrete]
  658. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  659. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  660. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  661. // CHECK:STDOUT: }
  662. // CHECK:STDOUT:
  663. // CHECK:STDOUT: file {
  664. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  665. // CHECK:STDOUT: .X = %X.decl
  666. // CHECK:STDOUT: .C = %C.decl
  667. // CHECK:STDOUT: }
  668. // CHECK:STDOUT: %X.decl: type = constraint_decl @X [concrete = constants.%X.type] {} {}
  669. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  670. // CHECK:STDOUT: impl_decl @C.as.<error>.impl [concrete] {} {
  671. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  672. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [concrete = constants.%X.type]
  673. // CHECK:STDOUT: }
  674. // CHECK:STDOUT: }
  675. // CHECK:STDOUT:
  676. // CHECK:STDOUT: constraint @X;
  677. // CHECK:STDOUT:
  678. // CHECK:STDOUT: impl @C.as.<error>.impl: %C.ref as %X.ref;
  679. // CHECK:STDOUT:
  680. // CHECK:STDOUT: class @C {
  681. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  682. // CHECK:STDOUT: complete_type_witness = %complete_type
  683. // CHECK:STDOUT:
  684. // CHECK:STDOUT: !members:
  685. // CHECK:STDOUT: .Self = constants.%C
  686. // CHECK:STDOUT: }
  687. // CHECK:STDOUT:
  688. // CHECK:STDOUT: --- nested_require_incomplete_interface.carbon
  689. // CHECK:STDOUT:
  690. // CHECK:STDOUT: constants {
  691. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  692. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  693. // CHECK:STDOUT: %Self.3c3: %Y.type = symbolic_binding Self, 0 [symbolic]
  694. // CHECK:STDOUT: %Self.binding.as_type.6a7: type = symbolic_binding_type Self, 0, %Self.3c3 [symbolic]
  695. // CHECK:STDOUT: %X.type: type = facet_type <@X> [concrete]
  696. // CHECK:STDOUT: %Self.e93: %X.type = symbolic_binding Self, 0 [symbolic]
  697. // CHECK:STDOUT: %Self.binding.as_type.072: type = symbolic_binding_type Self, 0, %Self.e93 [symbolic]
  698. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  699. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  700. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  701. // CHECK:STDOUT: %X.impl_witness: <witness> = impl_witness file.%X.impl_witness_table [concrete]
  702. // CHECK:STDOUT: }
  703. // CHECK:STDOUT:
  704. // CHECK:STDOUT: file {
  705. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  706. // CHECK:STDOUT: .Z = %Z.decl
  707. // CHECK:STDOUT: .Y = %Y.decl
  708. // CHECK:STDOUT: .X = %X.decl
  709. // CHECK:STDOUT: .C = %C.decl
  710. // CHECK:STDOUT: }
  711. // CHECK:STDOUT: %Z.decl: type = interface_decl @Z [concrete = constants.%Z.type] {} {}
  712. // CHECK:STDOUT: %Y.decl: type = constraint_decl @Y [concrete = constants.%Y.type] {} {}
  713. // CHECK:STDOUT: %X.decl: type = interface_decl @X [concrete = constants.%X.type] {} {}
  714. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  715. // CHECK:STDOUT: impl_decl @C.as.X.impl [concrete] {} {
  716. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  717. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [concrete = constants.%X.type]
  718. // CHECK:STDOUT: }
  719. // CHECK:STDOUT: %X.impl_witness_table = impl_witness_table (), @C.as.X.impl [concrete]
  720. // CHECK:STDOUT: %X.impl_witness: <witness> = impl_witness %X.impl_witness_table [concrete = constants.%X.impl_witness]
  721. // CHECK:STDOUT: }
  722. // CHECK:STDOUT:
  723. // CHECK:STDOUT: interface @Z;
  724. // CHECK:STDOUT:
  725. // CHECK:STDOUT: interface @X {
  726. // CHECK:STDOUT: %Self: %X.type = symbolic_binding Self, 0 [symbolic = constants.%Self.e93]
  727. // CHECK:STDOUT: %X.require1.decl = require_decl @X.require1 [concrete] {
  728. // CHECK:STDOUT: require %Self.as_type impls %Y.ref
  729. // CHECK:STDOUT: } {
  730. // CHECK:STDOUT: %Self.as_type: type = facet_access_type @X.%Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.072)]
  731. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  732. // CHECK:STDOUT: }
  733. // CHECK:STDOUT:
  734. // CHECK:STDOUT: !members:
  735. // CHECK:STDOUT: .Self = %Self
  736. // CHECK:STDOUT: .Y = <poisoned>
  737. // CHECK:STDOUT: witness = ()
  738. // CHECK:STDOUT:
  739. // CHECK:STDOUT: !requires:
  740. // CHECK:STDOUT: @X.require1 {
  741. // CHECK:STDOUT: require @X.require1.%Self.as_type impls @X.require1.%Y.ref
  742. // CHECK:STDOUT: }
  743. // CHECK:STDOUT: }
  744. // CHECK:STDOUT:
  745. // CHECK:STDOUT: constraint @Y {
  746. // CHECK:STDOUT: %Self: %Y.type = symbolic_binding Self, 0 [symbolic = constants.%Self.3c3]
  747. // CHECK:STDOUT: %Y.require0.decl = require_decl @Y.require0 [concrete] {
  748. // CHECK:STDOUT: require %Self.as_type impls %Z.ref
  749. // CHECK:STDOUT: } {
  750. // CHECK:STDOUT: %Self.as_type: type = facet_access_type @Y.%Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.6a7)]
  751. // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
  752. // CHECK:STDOUT: }
  753. // CHECK:STDOUT:
  754. // CHECK:STDOUT: !members:
  755. // CHECK:STDOUT: .Self = %Self
  756. // CHECK:STDOUT: .Z = <poisoned>
  757. // CHECK:STDOUT:
  758. // CHECK:STDOUT: !requires:
  759. // CHECK:STDOUT: @Y.require0 {
  760. // CHECK:STDOUT: require @Y.require0.%Self.as_type impls @Y.require0.%Z.ref
  761. // CHECK:STDOUT: }
  762. // CHECK:STDOUT: }
  763. // CHECK:STDOUT:
  764. // CHECK:STDOUT: generic require @Y.require0(@Y.%Self: %Y.type) {
  765. // CHECK:STDOUT: %Self: %Y.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.3c3)]
  766. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.6a7)]
  767. // CHECK:STDOUT: }
  768. // CHECK:STDOUT:
  769. // CHECK:STDOUT: generic require @X.require1(@X.%Self: %X.type) {
  770. // CHECK:STDOUT: %Self: %X.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.e93)]
  771. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.072)]
  772. // CHECK:STDOUT: }
  773. // CHECK:STDOUT:
  774. // CHECK:STDOUT: impl @C.as.X.impl: %C.ref as %X.ref {
  775. // CHECK:STDOUT: !members:
  776. // CHECK:STDOUT: witness = file.%X.impl_witness
  777. // CHECK:STDOUT: }
  778. // CHECK:STDOUT:
  779. // CHECK:STDOUT: class @C {
  780. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  781. // CHECK:STDOUT: complete_type_witness = %complete_type
  782. // CHECK:STDOUT:
  783. // CHECK:STDOUT: !members:
  784. // CHECK:STDOUT: .Self = constants.%C
  785. // CHECK:STDOUT: }
  786. // CHECK:STDOUT:
  787. // CHECK:STDOUT: specific @Y.require0(constants.%Self.3c3) {
  788. // CHECK:STDOUT: %Self => constants.%Self.3c3
  789. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.6a7
  790. // CHECK:STDOUT: }
  791. // CHECK:STDOUT:
  792. // CHECK:STDOUT: specific @X.require1(constants.%Self.e93) {
  793. // CHECK:STDOUT: %Self => constants.%Self.e93
  794. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.072
  795. // CHECK:STDOUT: }
  796. // CHECK:STDOUT:
  797. // CHECK:STDOUT: --- fail_incomplete_constraint.carbon
  798. // CHECK:STDOUT:
  799. // CHECK:STDOUT: constants {
  800. // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete]
  801. // CHECK:STDOUT: %B.type: type = facet_type <@B> [concrete]
  802. // CHECK:STDOUT: %Self: %B.type = symbolic_binding Self, 0 [symbolic]
  803. // CHECK:STDOUT: }
  804. // CHECK:STDOUT:
  805. // CHECK:STDOUT: file {
  806. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  807. // CHECK:STDOUT: .A = %A.decl
  808. // CHECK:STDOUT: .B = %B.decl
  809. // CHECK:STDOUT: }
  810. // CHECK:STDOUT: %A.decl: type = constraint_decl @A [concrete = constants.%A.type] {} {}
  811. // CHECK:STDOUT: %B.decl: type = interface_decl @B [concrete = constants.%B.type] {} {}
  812. // CHECK:STDOUT: }
  813. // CHECK:STDOUT:
  814. // CHECK:STDOUT: interface @B {
  815. // CHECK:STDOUT: %Self: %B.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  816. // CHECK:STDOUT:
  817. // CHECK:STDOUT: !members:
  818. // CHECK:STDOUT: .Self = %Self
  819. // CHECK:STDOUT: .A = <poisoned>
  820. // CHECK:STDOUT: witness = ()
  821. // CHECK:STDOUT:
  822. // CHECK:STDOUT: !requires:
  823. // CHECK:STDOUT: }
  824. // CHECK:STDOUT:
  825. // CHECK:STDOUT: constraint @A;
  826. // CHECK:STDOUT: