incomplete.carbon 24 KB

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