incomplete.carbon 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  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/interface/incomplete.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/incomplete.carbon
  14. // --- incomplete_type.carbon
  15. library "[[@TEST_NAME]]";
  16. class C;
  17. interface I {
  18. let T:! C;
  19. }
  20. // --- fail_incomplete_type_impl.carbon
  21. library "[[@TEST_NAME]]";
  22. class C;
  23. interface I {
  24. let T:! C;
  25. }
  26. // CHECK:STDERR: fail_incomplete_type_impl.carbon:[[@LINE+7]]:26: error: invalid use of incomplete type `C` [IncompleteTypeInConversion]
  27. // CHECK:STDERR: impl {} as I where .T = ({} as C) {}
  28. // CHECK:STDERR: ^~~~~~~
  29. // CHECK:STDERR: fail_incomplete_type_impl.carbon:[[@LINE-9]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
  30. // CHECK:STDERR: class C;
  31. // CHECK:STDERR: ^~~~~~~~
  32. // CHECK:STDERR:
  33. impl {} as I where .T = ({} as C) {}
  34. // --- fail_incomplete_type_usage.carbon
  35. library "[[@TEST_NAME]]";
  36. class C;
  37. interface I {
  38. let T:! C;
  39. }
  40. fn F[U:! I](a: U) {
  41. // CHECK:STDERR: fail_incomplete_type_usage.carbon:[[@LINE+7]]:3: error: invalid use of incomplete type `C` [IncompleteTypeInConversion]
  42. // CHECK:STDERR: a.T;
  43. // CHECK:STDERR: ^~~
  44. // CHECK:STDERR: fail_incomplete_type_usage.carbon:[[@LINE-10]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
  45. // CHECK:STDERR: class C;
  46. // CHECK:STDERR: ^~~~~~~~
  47. // CHECK:STDERR:
  48. a.T;
  49. }
  50. // --- fail_incomplete_extend_constraint.carbon
  51. library "[[@TEST_NAME]]";
  52. constraint A;
  53. interface B {
  54. // CHECK:STDERR: fail_incomplete_extend_constraint.carbon:[[@LINE+7]]:24: error: facet type `A` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType]
  55. // CHECK:STDERR: extend require impls A;
  56. // CHECK:STDERR: ^
  57. // CHECK:STDERR: fail_incomplete_extend_constraint.carbon:[[@LINE-6]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere]
  58. // CHECK:STDERR: constraint A;
  59. // CHECK:STDERR: ^~~~~~~~~~~~~
  60. // CHECK:STDERR:
  61. extend require impls A;
  62. }
  63. // --- fail_extend_require_enclosing.carbon
  64. library "[[@TEST_NAME]]";
  65. interface A {
  66. // CHECK:STDERR: fail_extend_require_enclosing.carbon:[[@LINE+7]]:24: error: `extend require` of incomplete facet type `A` [RequireImplsIncompleteFacetType]
  67. // CHECK:STDERR: extend require impls A;
  68. // CHECK:STDERR: ^
  69. // CHECK:STDERR: fail_extend_require_enclosing.carbon:[[@LINE-4]]:1: note: interface is currently being defined [InterfaceIncompleteWithinDefinition]
  70. // CHECK:STDERR: interface A {
  71. // CHECK:STDERR: ^~~~~~~~~~~~~
  72. // CHECK:STDERR:
  73. extend require impls A;
  74. }
  75. // --- fail_extend_require_enclosing_generic.carbon
  76. library "[[@TEST_NAME]]";
  77. interface A(T:! type) {
  78. // CHECK:STDERR: fail_extend_require_enclosing_generic.carbon:[[@LINE+7]]:24: error: `extend require` of incomplete facet type `A({})` [RequireImplsIncompleteFacetType]
  79. // CHECK:STDERR: extend require impls A({});
  80. // CHECK:STDERR: ^~~~~
  81. // CHECK:STDERR: fail_extend_require_enclosing_generic.carbon:[[@LINE-4]]:1: note: interface is currently being defined [InterfaceIncompleteWithinDefinition]
  82. // CHECK:STDERR: interface A(T:! type) {
  83. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
  84. // CHECK:STDERR:
  85. extend require impls A({});
  86. }
  87. // CHECK:STDOUT: --- incomplete_type.carbon
  88. // CHECK:STDOUT:
  89. // CHECK:STDOUT: constants {
  90. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  91. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  92. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic]
  93. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  94. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%T [concrete]
  95. // CHECK:STDOUT: }
  96. // CHECK:STDOUT:
  97. // CHECK:STDOUT: file {
  98. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  99. // CHECK:STDOUT: .C = %C.decl
  100. // CHECK:STDOUT: .I = %I.decl
  101. // CHECK:STDOUT: }
  102. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  103. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  104. // CHECK:STDOUT: }
  105. // CHECK:STDOUT:
  106. // CHECK:STDOUT: interface @I {
  107. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  108. // CHECK:STDOUT: %I.WithSelf.decl = interface_with_self_decl @I [concrete]
  109. // CHECK:STDOUT:
  110. // CHECK:STDOUT: !with Self:
  111. // CHECK:STDOUT: %T: %C = assoc_const_decl @T [concrete] {
  112. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%T [concrete = constants.%assoc0]
  113. // CHECK:STDOUT: }
  114. // CHECK:STDOUT:
  115. // CHECK:STDOUT: !members:
  116. // CHECK:STDOUT: .Self = %Self
  117. // CHECK:STDOUT: .C = <poisoned>
  118. // CHECK:STDOUT: .C = <poisoned>
  119. // CHECK:STDOUT: .T = @T.%assoc0
  120. // CHECK:STDOUT: witness = (@I.WithSelf.%T)
  121. // CHECK:STDOUT:
  122. // CHECK:STDOUT: !requires:
  123. // CHECK:STDOUT: }
  124. // CHECK:STDOUT:
  125. // CHECK:STDOUT: class @C;
  126. // CHECK:STDOUT:
  127. // CHECK:STDOUT: specific @I.WithSelf(constants.%Self) {}
  128. // CHECK:STDOUT:
  129. // CHECK:STDOUT: --- fail_incomplete_type_impl.carbon
  130. // CHECK:STDOUT:
  131. // CHECK:STDOUT: constants {
  132. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  133. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  134. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic]
  135. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  136. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%T [concrete]
  137. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  138. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  139. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self]
  140. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self [symbolic_self]
  141. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @I [symbolic_self]
  142. // CHECK:STDOUT: %impl.elem0: %C = impl_witness_access %I.lookup_impl_witness, element0 [symbolic_self]
  143. // CHECK:STDOUT: }
  144. // CHECK:STDOUT:
  145. // CHECK:STDOUT: file {
  146. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  147. // CHECK:STDOUT: .C = %C.decl
  148. // CHECK:STDOUT: .I = %I.decl
  149. // CHECK:STDOUT: }
  150. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  151. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  152. // CHECK:STDOUT: impl_decl @empty_struct_type.as.<error>.impl [concrete] {} {
  153. // CHECK:STDOUT: %.loc16_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  154. // CHECK:STDOUT: %.loc16_7.2: type = converted %.loc16_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  155. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  156. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  157. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  158. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  159. // CHECK:STDOUT: %.loc16_20: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  160. // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0]
  161. // CHECK:STDOUT: %impl.elem0: %C = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  162. // CHECK:STDOUT: %.loc16_27: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  163. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  164. // CHECK:STDOUT: %.loc16_14: type = where_expr %.Self [concrete = <error>] {
  165. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  166. // CHECK:STDOUT: requirement_rewrite %impl.elem0, <error>
  167. // CHECK:STDOUT: }
  168. // CHECK:STDOUT: }
  169. // CHECK:STDOUT: }
  170. // CHECK:STDOUT:
  171. // CHECK:STDOUT: interface @I {
  172. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  173. // CHECK:STDOUT: %I.WithSelf.decl = interface_with_self_decl @I [concrete]
  174. // CHECK:STDOUT:
  175. // CHECK:STDOUT: !with Self:
  176. // CHECK:STDOUT: %T: %C = assoc_const_decl @T [concrete] {
  177. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%T [concrete = constants.%assoc0]
  178. // CHECK:STDOUT: }
  179. // CHECK:STDOUT:
  180. // CHECK:STDOUT: !members:
  181. // CHECK:STDOUT: .Self = %Self
  182. // CHECK:STDOUT: .C = <poisoned>
  183. // CHECK:STDOUT: .C = <poisoned>
  184. // CHECK:STDOUT: .T = @T.%assoc0
  185. // CHECK:STDOUT: witness = (@I.WithSelf.%T)
  186. // CHECK:STDOUT:
  187. // CHECK:STDOUT: !requires:
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT:
  190. // CHECK:STDOUT: impl @empty_struct_type.as.<error>.impl: %.loc16_7.2 as %.loc16_14 {
  191. // CHECK:STDOUT: !members:
  192. // CHECK:STDOUT: witness = <error>
  193. // CHECK:STDOUT: }
  194. // CHECK:STDOUT:
  195. // CHECK:STDOUT: class @C;
  196. // CHECK:STDOUT:
  197. // CHECK:STDOUT: specific @I.WithSelf(constants.%Self) {
  198. // CHECK:STDOUT: !definition:
  199. // CHECK:STDOUT: }
  200. // CHECK:STDOUT:
  201. // CHECK:STDOUT: specific @I.WithSelf(constants.%.Self) {
  202. // CHECK:STDOUT: !definition:
  203. // CHECK:STDOUT: }
  204. // CHECK:STDOUT:
  205. // CHECK:STDOUT: --- fail_incomplete_type_usage.carbon
  206. // CHECK:STDOUT:
  207. // CHECK:STDOUT: constants {
  208. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  209. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  210. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic]
  211. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  212. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%T [concrete]
  213. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  214. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  215. // CHECK:STDOUT: %U: %I.type = symbolic_binding U, 0 [symbolic]
  216. // CHECK:STDOUT: %pattern_type.9d9: type = pattern_type %I.type [concrete]
  217. // CHECK:STDOUT: %U.binding.as_type: type = symbolic_binding_type U, 0, %U [symbolic]
  218. // CHECK:STDOUT: %pattern_type.422: type = pattern_type %U.binding.as_type [symbolic]
  219. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  220. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  221. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %U.binding.as_type [symbolic]
  222. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %U, @I [symbolic]
  223. // CHECK:STDOUT: %impl.elem0: %C = impl_witness_access %I.lookup_impl_witness, element0 [symbolic]
  224. // CHECK:STDOUT: }
  225. // CHECK:STDOUT:
  226. // CHECK:STDOUT: file {
  227. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  228. // CHECK:STDOUT: .C = %C.decl
  229. // CHECK:STDOUT: .I = %I.decl
  230. // CHECK:STDOUT: .F = %F.decl
  231. // CHECK:STDOUT: }
  232. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  233. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  234. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  235. // CHECK:STDOUT: %U.patt: %pattern_type.9d9 = symbolic_binding_pattern U, 0 [concrete]
  236. // CHECK:STDOUT: %a.patt: @F.%pattern_type (%pattern_type.422) = value_binding_pattern a [concrete]
  237. // CHECK:STDOUT: %a.param_patt: @F.%pattern_type (%pattern_type.422) = value_param_pattern %a.patt [concrete]
  238. // CHECK:STDOUT: } {
  239. // CHECK:STDOUT: %.loc9_10: type = splice_block %I.ref [concrete = constants.%I.type] {
  240. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  241. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  242. // CHECK:STDOUT: }
  243. // CHECK:STDOUT: %U.loc9_6.2: %I.type = symbolic_binding U, 0 [symbolic = %U.loc9_6.1 (constants.%U)]
  244. // CHECK:STDOUT: %a.param: @F.%U.binding.as_type (%U.binding.as_type) = value_param call_param0
  245. // CHECK:STDOUT: %.loc9_16.1: type = splice_block %.loc9_16.2 [symbolic = %U.binding.as_type (constants.%U.binding.as_type)] {
  246. // CHECK:STDOUT: %U.ref: %I.type = name_ref U, %U.loc9_6.2 [symbolic = %U.loc9_6.1 (constants.%U)]
  247. // CHECK:STDOUT: %U.as_type: type = facet_access_type %U.ref [symbolic = %U.binding.as_type (constants.%U.binding.as_type)]
  248. // CHECK:STDOUT: %.loc9_16.2: type = converted %U.ref, %U.as_type [symbolic = %U.binding.as_type (constants.%U.binding.as_type)]
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT: %a: @F.%U.binding.as_type (%U.binding.as_type) = value_binding a, %a.param
  251. // CHECK:STDOUT: }
  252. // CHECK:STDOUT: }
  253. // CHECK:STDOUT:
  254. // CHECK:STDOUT: interface @I {
  255. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  256. // CHECK:STDOUT: %I.WithSelf.decl = interface_with_self_decl @I [concrete]
  257. // CHECK:STDOUT:
  258. // CHECK:STDOUT: !with Self:
  259. // CHECK:STDOUT: %T: %C = assoc_const_decl @T [concrete] {
  260. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%T [concrete = constants.%assoc0]
  261. // CHECK:STDOUT: }
  262. // CHECK:STDOUT:
  263. // CHECK:STDOUT: !members:
  264. // CHECK:STDOUT: .Self = %Self
  265. // CHECK:STDOUT: .C = <poisoned>
  266. // CHECK:STDOUT: .C = <poisoned>
  267. // CHECK:STDOUT: .T = @T.%assoc0
  268. // CHECK:STDOUT: witness = (@I.WithSelf.%T)
  269. // CHECK:STDOUT:
  270. // CHECK:STDOUT: !requires:
  271. // CHECK:STDOUT: }
  272. // CHECK:STDOUT:
  273. // CHECK:STDOUT: class @C;
  274. // CHECK:STDOUT:
  275. // CHECK:STDOUT: generic fn @F(%U.loc9_6.2: %I.type) {
  276. // CHECK:STDOUT: %U.loc9_6.1: %I.type = symbolic_binding U, 0 [symbolic = %U.loc9_6.1 (constants.%U)]
  277. // CHECK:STDOUT: %U.binding.as_type: type = symbolic_binding_type U, 0, %U.loc9_6.1 [symbolic = %U.binding.as_type (constants.%U.binding.as_type)]
  278. // CHECK:STDOUT: %pattern_type: type = pattern_type %U.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.422)]
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: !definition:
  281. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %U.binding.as_type [symbolic = %require_complete (constants.%require_complete)]
  282. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %U.loc9_6.1, @I [symbolic = %I.lookup_impl_witness (constants.%I.lookup_impl_witness)]
  283. // CHECK:STDOUT: %impl.elem0.loc17_4.2: %C = impl_witness_access %I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc17_4.2 (constants.%impl.elem0)]
  284. // CHECK:STDOUT:
  285. // CHECK:STDOUT: fn(%a.param: @F.%U.binding.as_type (%U.binding.as_type)) {
  286. // CHECK:STDOUT: !entry:
  287. // CHECK:STDOUT: %a.ref: @F.%U.binding.as_type (%U.binding.as_type) = name_ref a, %a
  288. // CHECK:STDOUT: %T.ref: %I.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0]
  289. // CHECK:STDOUT: %impl.elem0.loc17_4.1: %C = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc17_4.2 (constants.%impl.elem0)]
  290. // CHECK:STDOUT: return
  291. // CHECK:STDOUT: }
  292. // CHECK:STDOUT: }
  293. // CHECK:STDOUT:
  294. // CHECK:STDOUT: specific @I.WithSelf(constants.%Self) {
  295. // CHECK:STDOUT: !definition:
  296. // CHECK:STDOUT: }
  297. // CHECK:STDOUT:
  298. // CHECK:STDOUT: specific @F(constants.%U) {
  299. // CHECK:STDOUT: %U.loc9_6.1 => constants.%U
  300. // CHECK:STDOUT: %U.binding.as_type => constants.%U.binding.as_type
  301. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.422
  302. // CHECK:STDOUT: }
  303. // CHECK:STDOUT:
  304. // CHECK:STDOUT: specific @I.WithSelf(constants.%U) {
  305. // CHECK:STDOUT: !definition:
  306. // CHECK:STDOUT: }
  307. // CHECK:STDOUT:
  308. // CHECK:STDOUT: --- fail_incomplete_extend_constraint.carbon
  309. // CHECK:STDOUT:
  310. // CHECK:STDOUT: constants {
  311. // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete]
  312. // CHECK:STDOUT: %B.type: type = facet_type <@B> [concrete]
  313. // CHECK:STDOUT: %Self: %B.type = symbolic_binding Self, 0 [symbolic]
  314. // CHECK:STDOUT: }
  315. // CHECK:STDOUT:
  316. // CHECK:STDOUT: file {
  317. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  318. // CHECK:STDOUT: .A = %A.decl
  319. // CHECK:STDOUT: .B = %B.decl
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT: %A.decl: type = constraint_decl @A [concrete = constants.%A.type] {} {}
  322. // CHECK:STDOUT: %B.decl: type = interface_decl @B [concrete = constants.%B.type] {} {}
  323. // CHECK:STDOUT: }
  324. // CHECK:STDOUT:
  325. // CHECK:STDOUT: interface @B {
  326. // CHECK:STDOUT: %Self: %B.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  327. // CHECK:STDOUT: %B.WithSelf.decl = interface_with_self_decl @B [concrete]
  328. // CHECK:STDOUT:
  329. // CHECK:STDOUT: !members:
  330. // CHECK:STDOUT: .Self = %Self
  331. // CHECK:STDOUT: .A = <poisoned>
  332. // CHECK:STDOUT: .A = <poisoned>
  333. // CHECK:STDOUT: has_error
  334. // CHECK:STDOUT: witness = ()
  335. // CHECK:STDOUT:
  336. // CHECK:STDOUT: !requires:
  337. // CHECK:STDOUT: }
  338. // CHECK:STDOUT:
  339. // CHECK:STDOUT: constraint @A;
  340. // CHECK:STDOUT:
  341. // CHECK:STDOUT: specific @B.WithSelf(constants.%Self) {}
  342. // CHECK:STDOUT:
  343. // CHECK:STDOUT: --- fail_extend_require_enclosing.carbon
  344. // CHECK:STDOUT:
  345. // CHECK:STDOUT: constants {
  346. // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete]
  347. // CHECK:STDOUT: %Self: %A.type = symbolic_binding Self, 0 [symbolic]
  348. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic]
  349. // CHECK:STDOUT: }
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: file {
  352. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  353. // CHECK:STDOUT: .A = %A.decl
  354. // CHECK:STDOUT: }
  355. // CHECK:STDOUT: %A.decl: type = interface_decl @A [concrete = constants.%A.type] {} {}
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: interface @A {
  359. // CHECK:STDOUT: %Self: %A.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  360. // CHECK:STDOUT: %A.WithSelf.decl = interface_with_self_decl @A [concrete]
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: !with Self:
  363. // CHECK:STDOUT: %A.WithSelf.Self.binding.as_type.impls.A.type.require.decl = require_decl @A.WithSelf.Self.binding.as_type.impls.A.type.require [concrete] {
  364. // CHECK:STDOUT: require %Self.as_type impls %A.ref
  365. // CHECK:STDOUT: } {
  366. // CHECK:STDOUT: %Self.as_type: type = facet_access_type @A.%Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  367. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type]
  368. // CHECK:STDOUT: }
  369. // CHECK:STDOUT:
  370. // CHECK:STDOUT: !members:
  371. // CHECK:STDOUT: .Self = %Self
  372. // CHECK:STDOUT: .A = <poisoned>
  373. // CHECK:STDOUT: .A = <poisoned>
  374. // CHECK:STDOUT: witness = ()
  375. // CHECK:STDOUT:
  376. // CHECK:STDOUT: !requires:
  377. // CHECK:STDOUT: }
  378. // CHECK:STDOUT:
  379. // CHECK:STDOUT: generic require @A.WithSelf.Self.binding.as_type.impls.A.type.require(@A.%Self: %A.type) {
  380. // CHECK:STDOUT: %Self: %A.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)]
  381. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  382. // CHECK:STDOUT: }
  383. // CHECK:STDOUT:
  384. // CHECK:STDOUT: specific @A.WithSelf(constants.%Self) {}
  385. // CHECK:STDOUT:
  386. // CHECK:STDOUT: specific @A.WithSelf.Self.binding.as_type.impls.A.type.require(constants.%Self) {
  387. // CHECK:STDOUT: %Self => constants.%Self
  388. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  389. // CHECK:STDOUT: }
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: --- fail_extend_require_enclosing_generic.carbon
  392. // CHECK:STDOUT:
  393. // CHECK:STDOUT: constants {
  394. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  395. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  396. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  397. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  398. // CHECK:STDOUT: %A.type.464: type = generic_interface_type @A [concrete]
  399. // CHECK:STDOUT: %A.generic: %A.type.464 = struct_value () [concrete]
  400. // CHECK:STDOUT: %A.type.ade: type = facet_type <@A, @A(%T)> [symbolic]
  401. // CHECK:STDOUT: %Self: %A.type.ade = symbolic_binding Self, 1 [symbolic]
  402. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic]
  403. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  404. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  405. // CHECK:STDOUT: %A.type.69e: type = facet_type <@A, @A(%empty_struct_type)> [concrete]
  406. // CHECK:STDOUT: }
  407. // CHECK:STDOUT:
  408. // CHECK:STDOUT: file {
  409. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  410. // CHECK:STDOUT: .A = %A.decl
  411. // CHECK:STDOUT: }
  412. // CHECK:STDOUT: %A.decl: %A.type.464 = interface_decl @A [concrete = constants.%A.generic] {
  413. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  414. // CHECK:STDOUT: } {
  415. // CHECK:STDOUT: %.loc3_17.1: type = splice_block %.loc3_17.2 [concrete = type] {
  416. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  417. // CHECK:STDOUT: %.loc3_17.2: type = type_literal type [concrete = type]
  418. // CHECK:STDOUT: }
  419. // CHECK:STDOUT: %T.loc3_13.2: type = symbolic_binding T, 0 [symbolic = %T.loc3_13.1 (constants.%T)]
  420. // CHECK:STDOUT: }
  421. // CHECK:STDOUT: }
  422. // CHECK:STDOUT:
  423. // CHECK:STDOUT: generic interface @A(%T.loc3_13.2: type) {
  424. // CHECK:STDOUT: %T.loc3_13.1: type = symbolic_binding T, 0 [symbolic = %T.loc3_13.1 (constants.%T)]
  425. // CHECK:STDOUT:
  426. // CHECK:STDOUT: !definition:
  427. // CHECK:STDOUT: %A.type: type = facet_type <@A, @A(%T.loc3_13.1)> [symbolic = %A.type (constants.%A.type.ade)]
  428. // CHECK:STDOUT: %Self.loc3_23.2: @A.%A.type (%A.type.ade) = symbolic_binding Self, 1 [symbolic = %Self.loc3_23.2 (constants.%Self)]
  429. // CHECK:STDOUT:
  430. // CHECK:STDOUT: interface {
  431. // CHECK:STDOUT: %Self.loc3_23.1: @A.%A.type (%A.type.ade) = symbolic_binding Self, 1 [symbolic = %Self.loc3_23.2 (constants.%Self)]
  432. // CHECK:STDOUT: %A.WithSelf.decl = interface_with_self_decl @A [concrete]
  433. // CHECK:STDOUT:
  434. // CHECK:STDOUT: !with Self:
  435. // CHECK:STDOUT: %A.WithSelf.Self.binding.as_type.impls.A.type.require.decl = require_decl @A.WithSelf.Self.binding.as_type.impls.A.type.require [concrete] {
  436. // CHECK:STDOUT: require %Self.as_type impls %A.type.loc11_28
  437. // CHECK:STDOUT: } {
  438. // CHECK:STDOUT: %Self.as_type: type = facet_access_type @A.%Self.loc3_23.1 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  439. // CHECK:STDOUT: %A.ref: %A.type.464 = name_ref A, file.%A.decl [concrete = constants.%A.generic]
  440. // CHECK:STDOUT: %.loc11_27: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  441. // CHECK:STDOUT: %.loc11_28: type = converted %.loc11_27, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  442. // CHECK:STDOUT: %A.type.loc11_28: type = facet_type <@A, @A(constants.%empty_struct_type)> [concrete = constants.%A.type.69e]
  443. // CHECK:STDOUT: }
  444. // CHECK:STDOUT:
  445. // CHECK:STDOUT: !members:
  446. // CHECK:STDOUT: .Self = %Self.loc3_23.1
  447. // CHECK:STDOUT: .A = <poisoned>
  448. // CHECK:STDOUT: .A = <poisoned>
  449. // CHECK:STDOUT: witness = ()
  450. // CHECK:STDOUT:
  451. // CHECK:STDOUT: !requires:
  452. // CHECK:STDOUT: }
  453. // CHECK:STDOUT: }
  454. // CHECK:STDOUT:
  455. // CHECK:STDOUT: generic require @A.WithSelf.Self.binding.as_type.impls.A.type.require(@A.%T.loc3_13.2: type, @A.%Self.loc3_23.1: @A.%A.type (%A.type.ade)) {
  456. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)]
  457. // CHECK:STDOUT: %A.type.loc11_18: type = facet_type <@A, @A(%T)> [symbolic = %A.type.loc11_18 (constants.%A.type.ade)]
  458. // CHECK:STDOUT: %Self: @A.WithSelf.Self.binding.as_type.impls.A.type.require.%A.type.loc11_18 (%A.type.ade) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self)]
  459. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  460. // CHECK:STDOUT: }
  461. // CHECK:STDOUT:
  462. // CHECK:STDOUT: specific @A(constants.%T) {
  463. // CHECK:STDOUT: %T.loc3_13.1 => constants.%T
  464. // CHECK:STDOUT: }
  465. // CHECK:STDOUT:
  466. // CHECK:STDOUT: specific @A.WithSelf(constants.%T, constants.%Self) {}
  467. // CHECK:STDOUT:
  468. // CHECK:STDOUT: specific @A(constants.%empty_struct_type) {
  469. // CHECK:STDOUT: %T.loc3_13.1 => constants.%empty_struct_type
  470. // CHECK:STDOUT: }
  471. // CHECK:STDOUT:
  472. // CHECK:STDOUT: specific @A.WithSelf.Self.binding.as_type.impls.A.type.require(constants.%T, constants.%Self) {
  473. // CHECK:STDOUT: %T => constants.%T
  474. // CHECK:STDOUT: %A.type.loc11_18 => constants.%A.type.ade
  475. // CHECK:STDOUT: %Self => constants.%Self
  476. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  477. // CHECK:STDOUT: }
  478. // CHECK:STDOUT: