fail_impl_as_scope.carbon 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/no_prelude/fail_impl_as_scope.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/fail_impl_as_scope.carbon
  10. // --- fail_impl_as_file_scope.carbon
  11. library "[[@TEST_NAME]]";
  12. interface I {}
  13. fn G() {}
  14. // CHECK:STDERR: fail_impl_as_file_scope.carbon:[[@LINE+4]]:6: error: `impl as` can only be used in a class [ImplAsOutsideClass]
  15. // CHECK:STDERR: impl as I {}
  16. // CHECK:STDERR: ^~
  17. // CHECK:STDERR:
  18. impl as I {}
  19. fn F() { G(); }
  20. // --- fail_impl_as_function_scope.carbon
  21. library "[[@TEST_NAME]]";
  22. interface J {}
  23. fn G() {}
  24. fn F() {
  25. // CHECK:STDERR: fail_impl_as_function_scope.carbon:[[@LINE+4]]:8: error: `impl as` can only be used in a class [ImplAsOutsideClass]
  26. // CHECK:STDERR: impl as J {}
  27. // CHECK:STDERR: ^~
  28. // CHECK:STDERR:
  29. impl as J {}
  30. G();
  31. }
  32. // --- fail_impl_as_self_interface.carbon
  33. library "[[@TEST_NAME]]";
  34. interface Z {
  35. fn Zero();
  36. // CHECK:STDERR: fail_impl_as_self_interface.carbon:[[@LINE+11]]:9: error: `impl as` can only be used in a class [ImplAsOutsideClass]
  37. // CHECK:STDERR: impl as Z {
  38. // CHECK:STDERR: ^~
  39. // CHECK:STDERR:
  40. // CHECK:STDERR: fail_impl_as_self_interface.carbon:[[@LINE+7]]:12: error: impl of undefined interface Z [ResolveFacetTypeWithUndefinedInterface]
  41. // CHECK:STDERR: impl as Z {
  42. // CHECK:STDERR: ^
  43. // CHECK:STDERR: fail_impl_as_self_interface.carbon:[[@LINE-10]]:1: note: interface is currently being defined [InterfaceUndefinedWithinDefinition]
  44. // CHECK:STDERR: interface Z {
  45. // CHECK:STDERR: ^~~~~~~~~~~~~
  46. // CHECK:STDERR:
  47. impl as Z {
  48. fn Zero() {}
  49. }
  50. }
  51. class Point {
  52. impl as Z {
  53. fn Zero() {}
  54. }
  55. }
  56. fn F() {
  57. // Even if the `impl` is diagnosed above, we must not add the impl of the
  58. // interface to itself in a way that allows it to be used during impl lookup,
  59. // or we end up with infinite impl lookup recursion here.
  60. ({} as Point).(Z.Zero)();
  61. }
  62. // --- fail_impl_as_other_interface.carbon
  63. library "[[@TEST_NAME]]";
  64. interface A {
  65. fn B();
  66. }
  67. interface C {}
  68. fn G() {}
  69. class X {
  70. impl as A {
  71. // CHECK:STDERR: fail_impl_as_other_interface.carbon:[[@LINE+4]]:10: error: `impl as` can only be used in a class [ImplAsOutsideClass]
  72. // CHECK:STDERR: impl as C {}
  73. // CHECK:STDERR: ^~
  74. // CHECK:STDERR:
  75. impl as C {}
  76. fn B() {
  77. G();
  78. }
  79. }
  80. }
  81. // CHECK:STDOUT: --- fail_impl_as_file_scope.carbon
  82. // CHECK:STDOUT:
  83. // CHECK:STDOUT: constants {
  84. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  85. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  86. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  87. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  88. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  89. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  90. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  91. // CHECK:STDOUT: }
  92. // CHECK:STDOUT:
  93. // CHECK:STDOUT: file {
  94. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  95. // CHECK:STDOUT: .I = %I.decl
  96. // CHECK:STDOUT: .G = %G.decl
  97. // CHECK:STDOUT: .F = %F.decl
  98. // CHECK:STDOUT: }
  99. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  100. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {}
  101. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  102. // CHECK:STDOUT: %Self.ref: type = name_ref Self, <error> [concrete = <error>]
  103. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  104. // CHECK:STDOUT: }
  105. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  106. // CHECK:STDOUT: }
  107. // CHECK:STDOUT:
  108. // CHECK:STDOUT: interface @I {
  109. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  110. // CHECK:STDOUT:
  111. // CHECK:STDOUT: !members:
  112. // CHECK:STDOUT: .Self = %Self
  113. // CHECK:STDOUT: witness = ()
  114. // CHECK:STDOUT: }
  115. // CHECK:STDOUT:
  116. // CHECK:STDOUT: impl @impl: %Self.ref as %I.ref {
  117. // CHECK:STDOUT: !members:
  118. // CHECK:STDOUT: witness = <error>
  119. // CHECK:STDOUT: }
  120. // CHECK:STDOUT:
  121. // CHECK:STDOUT: fn @G() {
  122. // CHECK:STDOUT: !entry:
  123. // CHECK:STDOUT: return
  124. // CHECK:STDOUT: }
  125. // CHECK:STDOUT:
  126. // CHECK:STDOUT: fn @F() {
  127. // CHECK:STDOUT: !entry:
  128. // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G]
  129. // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.ref()
  130. // CHECK:STDOUT: return
  131. // CHECK:STDOUT: }
  132. // CHECK:STDOUT:
  133. // CHECK:STDOUT: --- fail_impl_as_function_scope.carbon
  134. // CHECK:STDOUT:
  135. // CHECK:STDOUT: constants {
  136. // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete]
  137. // CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic]
  138. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  139. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  140. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  141. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  142. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  143. // CHECK:STDOUT: }
  144. // CHECK:STDOUT:
  145. // CHECK:STDOUT: file {
  146. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  147. // CHECK:STDOUT: .J = %J.decl
  148. // CHECK:STDOUT: .G = %G.decl
  149. // CHECK:STDOUT: .F = %F.decl
  150. // CHECK:STDOUT: }
  151. // CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {}
  152. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {}
  153. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  154. // CHECK:STDOUT: }
  155. // CHECK:STDOUT:
  156. // CHECK:STDOUT: interface @J {
  157. // CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  158. // CHECK:STDOUT:
  159. // CHECK:STDOUT: !members:
  160. // CHECK:STDOUT: .Self = %Self
  161. // CHECK:STDOUT: witness = ()
  162. // CHECK:STDOUT: }
  163. // CHECK:STDOUT:
  164. // CHECK:STDOUT: impl @impl: %Self.ref as %J.ref {
  165. // CHECK:STDOUT: !members:
  166. // CHECK:STDOUT: witness = <error>
  167. // CHECK:STDOUT: }
  168. // CHECK:STDOUT:
  169. // CHECK:STDOUT: fn @G() {
  170. // CHECK:STDOUT: !entry:
  171. // CHECK:STDOUT: return
  172. // CHECK:STDOUT: }
  173. // CHECK:STDOUT:
  174. // CHECK:STDOUT: fn @F() {
  175. // CHECK:STDOUT: !entry:
  176. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  177. // CHECK:STDOUT: %Self.ref: type = name_ref Self, <error> [concrete = <error>]
  178. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  179. // CHECK:STDOUT: }
  180. // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G]
  181. // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.ref()
  182. // CHECK:STDOUT: return
  183. // CHECK:STDOUT: }
  184. // CHECK:STDOUT:
  185. // CHECK:STDOUT: --- fail_impl_as_self_interface.carbon
  186. // CHECK:STDOUT:
  187. // CHECK:STDOUT: constants {
  188. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  189. // CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic]
  190. // CHECK:STDOUT: %Zero.type.822: type = fn_type @Zero.1 [concrete]
  191. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  192. // CHECK:STDOUT: %Zero.d14: %Zero.type.822 = struct_value () [concrete]
  193. // CHECK:STDOUT: %Z.assoc_type: type = assoc_entity_type %Z.type [concrete]
  194. // CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, @Z.%Zero.decl [concrete]
  195. // CHECK:STDOUT: %Zero.type.db4: type = fn_type @Zero.2, @impl.1(%Self) [symbolic]
  196. // CHECK:STDOUT: %Zero.8fb: %Zero.type.db4 = struct_value () [symbolic]
  197. // CHECK:STDOUT: %Point: type = class_type @Point [concrete]
  198. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.2.%Zero.decl) [concrete]
  199. // CHECK:STDOUT: %Zero.type.e33: type = fn_type @Zero.3 [concrete]
  200. // CHECK:STDOUT: %Zero.dec: %Zero.type.e33 = struct_value () [concrete]
  201. // CHECK:STDOUT: %Z.facet: %Z.type = facet_value %Point, %impl_witness [concrete]
  202. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  203. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  204. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  205. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  206. // CHECK:STDOUT: %Point.val: %Point = struct_value () [concrete]
  207. // CHECK:STDOUT: %.c37: type = fn_type_with_self_type %Zero.type.822, %Z.facet [concrete]
  208. // CHECK:STDOUT: }
  209. // CHECK:STDOUT:
  210. // CHECK:STDOUT: file {
  211. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  212. // CHECK:STDOUT: .Z = %Z.decl
  213. // CHECK:STDOUT: .Point = %Point.decl
  214. // CHECK:STDOUT: .F = %F.decl
  215. // CHECK:STDOUT: }
  216. // CHECK:STDOUT: %Z.decl: type = interface_decl @Z [concrete = constants.%Z.type] {} {}
  217. // CHECK:STDOUT: %Point.decl: type = class_decl @Point [concrete = constants.%Point] {} {}
  218. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  219. // CHECK:STDOUT: }
  220. // CHECK:STDOUT:
  221. // CHECK:STDOUT: interface @Z {
  222. // CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  223. // CHECK:STDOUT: %Zero.decl: %Zero.type.822 = fn_decl @Zero.1 [concrete = constants.%Zero.d14] {} {}
  224. // CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, %Zero.decl [concrete = constants.%assoc0]
  225. // CHECK:STDOUT: impl_decl @impl.1 [concrete] {} {
  226. // CHECK:STDOUT: %Self.ref: type = name_ref Self, <error> [concrete = <error>]
  227. // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
  228. // CHECK:STDOUT: }
  229. // CHECK:STDOUT:
  230. // CHECK:STDOUT: !members:
  231. // CHECK:STDOUT: .Self = %Self
  232. // CHECK:STDOUT: .Zero = %assoc0
  233. // CHECK:STDOUT: .Z = <poisoned>
  234. // CHECK:STDOUT: witness = (%Zero.decl)
  235. // CHECK:STDOUT: }
  236. // CHECK:STDOUT:
  237. // CHECK:STDOUT: generic impl @impl.1(@Z.%Self: %Z.type) {
  238. // CHECK:STDOUT: !definition:
  239. // CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)]
  240. // CHECK:STDOUT: %Zero.type: type = fn_type @Zero.2, @impl.1(%Self) [symbolic = %Zero.type (constants.%Zero.type.db4)]
  241. // CHECK:STDOUT: %Zero: @impl.1.%Zero.type (%Zero.type.db4) = struct_value () [symbolic = %Zero (constants.%Zero.8fb)]
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: impl: %Self.ref as %Z.ref {
  244. // CHECK:STDOUT: %Zero.decl: @impl.1.%Zero.type (%Zero.type.db4) = fn_decl @Zero.2 [symbolic = @impl.1.%Zero (constants.%Zero.8fb)] {} {}
  245. // CHECK:STDOUT:
  246. // CHECK:STDOUT: !members:
  247. // CHECK:STDOUT: .Zero = %Zero.decl
  248. // CHECK:STDOUT: witness = <error>
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT: }
  251. // CHECK:STDOUT:
  252. // CHECK:STDOUT: impl @impl.2: %Self.ref as %Z.ref {
  253. // CHECK:STDOUT: %Zero.decl: %Zero.type.e33 = fn_decl @Zero.3 [concrete = constants.%Zero.dec] {} {}
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: !members:
  256. // CHECK:STDOUT: .Zero = %Zero.decl
  257. // CHECK:STDOUT: witness = @Point.%impl_witness
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT:
  260. // CHECK:STDOUT: class @Point {
  261. // CHECK:STDOUT: impl_decl @impl.2 [concrete] {} {
  262. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Point [concrete = constants.%Point]
  263. // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.2.%Zero.decl) [concrete = constants.%impl_witness]
  266. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  267. // CHECK:STDOUT: complete_type_witness = %complete_type
  268. // CHECK:STDOUT:
  269. // CHECK:STDOUT: !members:
  270. // CHECK:STDOUT: .Self = constants.%Point
  271. // CHECK:STDOUT: .Z = <poisoned>
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: generic fn @Zero.1(@Z.%Self: %Z.type) {
  275. // CHECK:STDOUT: fn();
  276. // CHECK:STDOUT: }
  277. // CHECK:STDOUT:
  278. // CHECK:STDOUT: generic fn @Zero.2(@Z.%Self: %Z.type) {
  279. // CHECK:STDOUT: !definition:
  280. // CHECK:STDOUT:
  281. // CHECK:STDOUT: fn() {
  282. // CHECK:STDOUT: !entry:
  283. // CHECK:STDOUT: return
  284. // CHECK:STDOUT: }
  285. // CHECK:STDOUT: }
  286. // CHECK:STDOUT:
  287. // CHECK:STDOUT: fn @Zero.3() {
  288. // CHECK:STDOUT: !entry:
  289. // CHECK:STDOUT: return
  290. // CHECK:STDOUT: }
  291. // CHECK:STDOUT:
  292. // CHECK:STDOUT: fn @F() {
  293. // CHECK:STDOUT: !entry:
  294. // CHECK:STDOUT: %.loc32_5.1: %empty_struct_type = struct_literal ()
  295. // CHECK:STDOUT: %Point.ref: type = name_ref Point, file.%Point.decl [concrete = constants.%Point]
  296. // CHECK:STDOUT: %.loc32_5.2: ref %Point = temporary_storage
  297. // CHECK:STDOUT: %.loc32_5.3: init %Point = class_init (), %.loc32_5.2 [concrete = constants.%Point.val]
  298. // CHECK:STDOUT: %.loc32_5.4: ref %Point = temporary %.loc32_5.2, %.loc32_5.3
  299. // CHECK:STDOUT: %.loc32_7: ref %Point = converted %.loc32_5.1, %.loc32_5.4
  300. // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
  301. // CHECK:STDOUT: %Zero.ref: %Z.assoc_type = name_ref Zero, @Z.%assoc0 [concrete = constants.%assoc0]
  302. // CHECK:STDOUT: %impl.elem0: %.c37 = impl_witness_access constants.%impl_witness, element0 [concrete = constants.%Zero.dec]
  303. // CHECK:STDOUT: %Zero.call: init %empty_tuple.type = call %impl.elem0()
  304. // CHECK:STDOUT: return
  305. // CHECK:STDOUT: }
  306. // CHECK:STDOUT:
  307. // CHECK:STDOUT: specific @Zero.1(constants.%Self) {}
  308. // CHECK:STDOUT:
  309. // CHECK:STDOUT: specific @impl.1(constants.%Self) {
  310. // CHECK:STDOUT: !definition:
  311. // CHECK:STDOUT: %Self => constants.%Self
  312. // CHECK:STDOUT: %Zero.type => constants.%Zero.type.db4
  313. // CHECK:STDOUT: %Zero => constants.%Zero.8fb
  314. // CHECK:STDOUT: }
  315. // CHECK:STDOUT:
  316. // CHECK:STDOUT: specific @Zero.2(constants.%Self) {}
  317. // CHECK:STDOUT:
  318. // CHECK:STDOUT: specific @impl.1(%Self) {}
  319. // CHECK:STDOUT:
  320. // CHECK:STDOUT: specific @Zero.1(constants.%Z.facet) {}
  321. // CHECK:STDOUT:
  322. // CHECK:STDOUT: --- fail_impl_as_other_interface.carbon
  323. // CHECK:STDOUT:
  324. // CHECK:STDOUT: constants {
  325. // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete]
  326. // CHECK:STDOUT: %Self.31d: %A.type = bind_symbolic_name Self, 0 [symbolic]
  327. // CHECK:STDOUT: %B.type.1c3: type = fn_type @B.1 [concrete]
  328. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  329. // CHECK:STDOUT: %B.b08: %B.type.1c3 = struct_value () [concrete]
  330. // CHECK:STDOUT: %A.assoc_type: type = assoc_entity_type %A.type [concrete]
  331. // CHECK:STDOUT: %assoc0: %A.assoc_type = assoc_entity element0, @A.%B.decl [concrete]
  332. // CHECK:STDOUT: %C.type: type = facet_type <@C> [concrete]
  333. // CHECK:STDOUT: %Self.02e: %C.type = bind_symbolic_name Self, 0 [symbolic]
  334. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  335. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  336. // CHECK:STDOUT: %X: type = class_type @X [concrete]
  337. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.1.%B.decl) [concrete]
  338. // CHECK:STDOUT: %B.type.d47: type = fn_type @B.2 [concrete]
  339. // CHECK:STDOUT: %B.4af: %B.type.d47 = struct_value () [concrete]
  340. // CHECK:STDOUT: %A.facet: %A.type = facet_value %X, %impl_witness [concrete]
  341. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  342. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  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: .C = %C.decl
  349. // CHECK:STDOUT: .G = %G.decl
  350. // CHECK:STDOUT: .X = %X.decl
  351. // CHECK:STDOUT: }
  352. // CHECK:STDOUT: %A.decl: type = interface_decl @A [concrete = constants.%A.type] {} {}
  353. // CHECK:STDOUT: %C.decl: type = interface_decl @C [concrete = constants.%C.type] {} {}
  354. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {}
  355. // CHECK:STDOUT: %X.decl: type = class_decl @X [concrete = constants.%X] {} {}
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: interface @A {
  359. // CHECK:STDOUT: %Self: %A.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.31d]
  360. // CHECK:STDOUT: %B.decl: %B.type.1c3 = fn_decl @B.1 [concrete = constants.%B.b08] {} {}
  361. // CHECK:STDOUT: %assoc0: %A.assoc_type = assoc_entity element0, %B.decl [concrete = constants.%assoc0]
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: !members:
  364. // CHECK:STDOUT: .Self = %Self
  365. // CHECK:STDOUT: .B = %assoc0
  366. // CHECK:STDOUT: witness = (%B.decl)
  367. // CHECK:STDOUT: }
  368. // CHECK:STDOUT:
  369. // CHECK:STDOUT: interface @C {
  370. // CHECK:STDOUT: %Self: %C.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.02e]
  371. // CHECK:STDOUT:
  372. // CHECK:STDOUT: !members:
  373. // CHECK:STDOUT: .Self = %Self
  374. // CHECK:STDOUT: witness = ()
  375. // CHECK:STDOUT: }
  376. // CHECK:STDOUT:
  377. // CHECK:STDOUT: impl @impl.1: %Self.ref as %A.ref {
  378. // CHECK:STDOUT: impl_decl @impl.2 [concrete] {} {
  379. // CHECK:STDOUT: %Self.ref: type = name_ref Self, <error> [concrete = <error>]
  380. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C.type]
  381. // CHECK:STDOUT: }
  382. // CHECK:STDOUT: %B.decl: %B.type.d47 = fn_decl @B.2 [concrete = constants.%B.4af] {} {}
  383. // CHECK:STDOUT:
  384. // CHECK:STDOUT: !members:
  385. // CHECK:STDOUT: .C = <poisoned>
  386. // CHECK:STDOUT: .B = %B.decl
  387. // CHECK:STDOUT: .G = <poisoned>
  388. // CHECK:STDOUT: witness = @X.%impl_witness
  389. // CHECK:STDOUT: }
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: impl @impl.2: %Self.ref as %C.ref {
  392. // CHECK:STDOUT: !members:
  393. // CHECK:STDOUT: witness = <error>
  394. // CHECK:STDOUT: }
  395. // CHECK:STDOUT:
  396. // CHECK:STDOUT: class @X {
  397. // CHECK:STDOUT: impl_decl @impl.1 [concrete] {} {
  398. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%X [concrete = constants.%X]
  399. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type]
  400. // CHECK:STDOUT: }
  401. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.1.%B.decl) [concrete = constants.%impl_witness]
  402. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  403. // CHECK:STDOUT: complete_type_witness = %complete_type
  404. // CHECK:STDOUT:
  405. // CHECK:STDOUT: !members:
  406. // CHECK:STDOUT: .Self = constants.%X
  407. // CHECK:STDOUT: .A = <poisoned>
  408. // CHECK:STDOUT: .C = <poisoned>
  409. // CHECK:STDOUT: .G = <poisoned>
  410. // CHECK:STDOUT: }
  411. // CHECK:STDOUT:
  412. // CHECK:STDOUT: generic fn @B.1(@A.%Self: %A.type) {
  413. // CHECK:STDOUT: fn();
  414. // CHECK:STDOUT: }
  415. // CHECK:STDOUT:
  416. // CHECK:STDOUT: fn @G() {
  417. // CHECK:STDOUT: !entry:
  418. // CHECK:STDOUT: return
  419. // CHECK:STDOUT: }
  420. // CHECK:STDOUT:
  421. // CHECK:STDOUT: fn @B.2() {
  422. // CHECK:STDOUT: !entry:
  423. // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G]
  424. // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.ref()
  425. // CHECK:STDOUT: return
  426. // CHECK:STDOUT: }
  427. // CHECK:STDOUT:
  428. // CHECK:STDOUT: specific @B.1(constants.%Self.31d) {}
  429. // CHECK:STDOUT:
  430. // CHECK:STDOUT: specific @B.1(constants.%A.facet) {}
  431. // CHECK:STDOUT: