fail_impl_as_scope.carbon 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  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/destroy.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/fail_impl_as_scope.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_impl_as_scope.carbon
  14. // --- fail_impl_as_file_scope.carbon
  15. library "[[@TEST_NAME]]";
  16. interface I {}
  17. fn G() {}
  18. // CHECK:STDERR: fail_impl_as_file_scope.carbon:[[@LINE+4]]:6: error: `impl as` can only be used in a class [ImplAsOutsideClass]
  19. // CHECK:STDERR: impl as I {}
  20. // CHECK:STDERR: ^~
  21. // CHECK:STDERR:
  22. impl as I {}
  23. fn F() { G(); }
  24. // --- fail_impl_as_function_scope.carbon
  25. library "[[@TEST_NAME]]";
  26. interface J {}
  27. fn G() {}
  28. fn F() {
  29. // CHECK:STDERR: fail_impl_as_function_scope.carbon:[[@LINE+4]]:8: error: `impl as` can only be used in a class [ImplAsOutsideClass]
  30. // CHECK:STDERR: impl as J {}
  31. // CHECK:STDERR: ^~
  32. // CHECK:STDERR:
  33. impl as J {}
  34. G();
  35. }
  36. // --- fail_impl_as_self_interface.carbon
  37. library "[[@TEST_NAME]]";
  38. interface Z {
  39. fn Zero();
  40. fn Method[self: Self]();
  41. // CHECK:STDERR: fail_impl_as_self_interface.carbon:[[@LINE+4]]:9: error: `impl as` can only be used in a class [ImplAsOutsideClass]
  42. // CHECK:STDERR: impl as Z {
  43. // CHECK:STDERR: ^~
  44. // CHECK:STDERR:
  45. impl as Z {
  46. fn Zero() {}
  47. fn Method[unused self: Self]() {}
  48. }
  49. }
  50. class Point {
  51. impl as Z {
  52. fn Zero() {}
  53. fn Method[unused self: Self]() {}
  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. Point.(Z.Zero)();
  61. ({} as Point).(Z.Method)();
  62. }
  63. // --- fail_impl_as_other_interface.carbon
  64. library "[[@TEST_NAME]]";
  65. interface A {
  66. fn B();
  67. }
  68. interface C {}
  69. fn G() {}
  70. class X {
  71. impl as A {
  72. // CHECK:STDERR: fail_impl_as_other_interface.carbon:[[@LINE+4]]:10: error: `impl as` can only be used in a class [ImplAsOutsideClass]
  73. // CHECK:STDERR: impl as C {}
  74. // CHECK:STDERR: ^~
  75. // CHECK:STDERR:
  76. impl as C {}
  77. fn B() {
  78. G();
  79. }
  80. }
  81. }
  82. // CHECK:STDOUT: --- fail_impl_as_file_scope.carbon
  83. // CHECK:STDOUT:
  84. // CHECK:STDOUT: constants {
  85. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  86. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic]
  87. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  88. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  89. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  90. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  91. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  92. // CHECK:STDOUT: }
  93. // CHECK:STDOUT:
  94. // CHECK:STDOUT: imports {
  95. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  96. // CHECK:STDOUT: import Core//prelude
  97. // CHECK:STDOUT: import Core//prelude/...
  98. // CHECK:STDOUT: }
  99. // CHECK:STDOUT: }
  100. // CHECK:STDOUT:
  101. // CHECK:STDOUT: file {
  102. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  103. // CHECK:STDOUT: .Core = imports.%Core
  104. // CHECK:STDOUT: .I = %I.decl
  105. // CHECK:STDOUT: .G = %G.decl
  106. // CHECK:STDOUT: .F = %F.decl
  107. // CHECK:STDOUT: }
  108. // CHECK:STDOUT: %Core.import = import Core
  109. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  110. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {}
  111. // CHECK:STDOUT: impl_decl @<error>.as.I.impl [concrete] {} {
  112. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  113. // CHECK:STDOUT: }
  114. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  115. // CHECK:STDOUT: }
  116. // CHECK:STDOUT:
  117. // CHECK:STDOUT: interface @I {
  118. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  119. // CHECK:STDOUT: %I.WithSelf.decl = interface_with_self_decl @I [concrete]
  120. // CHECK:STDOUT:
  121. // CHECK:STDOUT: !members:
  122. // CHECK:STDOUT: .Self = %Self
  123. // CHECK:STDOUT: witness = ()
  124. // CHECK:STDOUT:
  125. // CHECK:STDOUT: !requires:
  126. // CHECK:STDOUT: }
  127. // CHECK:STDOUT:
  128. // CHECK:STDOUT: impl @<error>.as.I.impl: <error> as %I.ref {
  129. // CHECK:STDOUT: !members:
  130. // CHECK:STDOUT: witness = <error>
  131. // CHECK:STDOUT: }
  132. // CHECK:STDOUT:
  133. // CHECK:STDOUT: fn @G() {
  134. // CHECK:STDOUT: !entry:
  135. // CHECK:STDOUT: return
  136. // CHECK:STDOUT: }
  137. // CHECK:STDOUT:
  138. // CHECK:STDOUT: fn @F() {
  139. // CHECK:STDOUT: !entry:
  140. // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G]
  141. // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.ref()
  142. // CHECK:STDOUT: return
  143. // CHECK:STDOUT: }
  144. // CHECK:STDOUT:
  145. // CHECK:STDOUT: specific @I.WithSelf(constants.%Self) {}
  146. // CHECK:STDOUT:
  147. // CHECK:STDOUT: --- fail_impl_as_function_scope.carbon
  148. // CHECK:STDOUT:
  149. // CHECK:STDOUT: constants {
  150. // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete]
  151. // CHECK:STDOUT: %Self: %J.type = symbolic_binding Self, 0 [symbolic]
  152. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  153. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  154. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  155. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  156. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT:
  159. // CHECK:STDOUT: imports {
  160. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  161. // CHECK:STDOUT: import Core//prelude
  162. // CHECK:STDOUT: import Core//prelude/...
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT: }
  165. // CHECK:STDOUT:
  166. // CHECK:STDOUT: file {
  167. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  168. // CHECK:STDOUT: .Core = imports.%Core
  169. // CHECK:STDOUT: .J = %J.decl
  170. // CHECK:STDOUT: .G = %G.decl
  171. // CHECK:STDOUT: .F = %F.decl
  172. // CHECK:STDOUT: }
  173. // CHECK:STDOUT: %Core.import = import Core
  174. // CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {}
  175. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {}
  176. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  177. // CHECK:STDOUT: }
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: interface @J {
  180. // CHECK:STDOUT: %Self: %J.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  181. // CHECK:STDOUT: %J.WithSelf.decl = interface_with_self_decl @J [concrete]
  182. // CHECK:STDOUT:
  183. // CHECK:STDOUT: !members:
  184. // CHECK:STDOUT: .Self = %Self
  185. // CHECK:STDOUT: witness = ()
  186. // CHECK:STDOUT:
  187. // CHECK:STDOUT: !requires:
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT:
  190. // CHECK:STDOUT: impl @<error>.as.J.impl: <error> as %J.ref {
  191. // CHECK:STDOUT: !members:
  192. // CHECK:STDOUT: witness = <error>
  193. // CHECK:STDOUT: }
  194. // CHECK:STDOUT:
  195. // CHECK:STDOUT: fn @G() {
  196. // CHECK:STDOUT: !entry:
  197. // CHECK:STDOUT: return
  198. // CHECK:STDOUT: }
  199. // CHECK:STDOUT:
  200. // CHECK:STDOUT: fn @F() {
  201. // CHECK:STDOUT: !entry:
  202. // CHECK:STDOUT: impl_decl @<error>.as.J.impl [concrete] {} {
  203. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  204. // CHECK:STDOUT: }
  205. // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G]
  206. // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.ref()
  207. // CHECK:STDOUT: return
  208. // CHECK:STDOUT: }
  209. // CHECK:STDOUT:
  210. // CHECK:STDOUT: specific @J.WithSelf(constants.%Self) {}
  211. // CHECK:STDOUT:
  212. // CHECK:STDOUT: --- fail_impl_as_self_interface.carbon
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: constants {
  215. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  216. // CHECK:STDOUT: %Self.c59: %Z.type = symbolic_binding Self, 0 [symbolic]
  217. // CHECK:STDOUT: %Z.WithSelf.Zero.type.e4a: type = fn_type @Z.WithSelf.Zero, @Z.WithSelf(%Self.c59) [symbolic]
  218. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  219. // CHECK:STDOUT: %Z.WithSelf.Zero.3f4: %Z.WithSelf.Zero.type.e4a = struct_value () [symbolic]
  220. // CHECK:STDOUT: %Z.assoc_type: type = assoc_entity_type @Z [concrete]
  221. // CHECK:STDOUT: %assoc0.cc0: %Z.assoc_type = assoc_entity element0, @Z.WithSelf.%Z.WithSelf.Zero.decl [concrete]
  222. // CHECK:STDOUT: %Self.binding.as_type.62d: type = symbolic_binding_type Self, 0, %Self.c59 [symbolic]
  223. // CHECK:STDOUT: %pattern_type.84b: type = pattern_type %Self.binding.as_type.62d [symbolic]
  224. // CHECK:STDOUT: %Z.WithSelf.Method.type.dfd: type = fn_type @Z.WithSelf.Method, @Z.WithSelf(%Self.c59) [symbolic]
  225. // CHECK:STDOUT: %Z.WithSelf.Method.324: %Z.WithSelf.Method.type.dfd = struct_value () [symbolic]
  226. // CHECK:STDOUT: %assoc1: %Z.assoc_type = assoc_entity element1, @Z.WithSelf.%Z.WithSelf.Method.decl [concrete]
  227. // CHECK:STDOUT: %<error>.as.Z.impl.Zero.type: type = fn_type @<error>.as.Z.impl.Zero, @<error>.as.Z.impl(%Self.c59) [symbolic]
  228. // CHECK:STDOUT: %<error>.as.Z.impl.Zero: %<error>.as.Z.impl.Zero.type = struct_value () [symbolic]
  229. // CHECK:STDOUT: %<error>.as.Z.impl.Method.type: type = fn_type @<error>.as.Z.impl.Method, @<error>.as.Z.impl(%Self.c59) [symbolic]
  230. // CHECK:STDOUT: %<error>.as.Z.impl.Method: %<error>.as.Z.impl.Method.type = struct_value () [symbolic]
  231. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %Self.binding.as_type.62d [symbolic]
  232. // CHECK:STDOUT: %Point: type = class_type @Point [concrete]
  233. // CHECK:STDOUT: %Z.impl_witness: <witness> = impl_witness @Point.as.Z.impl.%Z.impl_witness_table [concrete]
  234. // CHECK:STDOUT: %Point.as.Z.impl.Zero.type: type = fn_type @Point.as.Z.impl.Zero [concrete]
  235. // CHECK:STDOUT: %Point.as.Z.impl.Zero: %Point.as.Z.impl.Zero.type = struct_value () [concrete]
  236. // CHECK:STDOUT: %pattern_type.c86: type = pattern_type %Point [concrete]
  237. // CHECK:STDOUT: %Point.as.Z.impl.Method.type: type = fn_type @Point.as.Z.impl.Method [concrete]
  238. // CHECK:STDOUT: %Point.as.Z.impl.Method: %Point.as.Z.impl.Method.type = struct_value () [concrete]
  239. // CHECK:STDOUT: %Z.facet: %Z.type = facet_value %Point, (%Z.impl_witness) [concrete]
  240. // CHECK:STDOUT: %Z.WithSelf.Zero.type.949: type = fn_type @Z.WithSelf.Zero, @Z.WithSelf(%Z.facet) [concrete]
  241. // CHECK:STDOUT: %Z.WithSelf.Zero.3ae: %Z.WithSelf.Zero.type.949 = struct_value () [concrete]
  242. // CHECK:STDOUT: %Z.WithSelf.Method.type.707: type = fn_type @Z.WithSelf.Method, @Z.WithSelf(%Z.facet) [concrete]
  243. // CHECK:STDOUT: %Z.WithSelf.Method.74d: %Z.WithSelf.Method.type.707 = struct_value () [concrete]
  244. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  245. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  246. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  247. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  248. // CHECK:STDOUT: %.8c9: type = fn_type_with_self_type %Z.WithSelf.Zero.type.949, %Z.facet [concrete]
  249. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  250. // CHECK:STDOUT: %Point.val: %Point = struct_value () [concrete]
  251. // CHECK:STDOUT: %.429: type = fn_type_with_self_type %Z.WithSelf.Method.type.707, %Z.facet [concrete]
  252. // CHECK:STDOUT: %Point.as.Z.impl.Method.bound: <bound method> = bound_method %Point.val, %Point.as.Z.impl.Method [concrete]
  253. // CHECK:STDOUT: %.fcf: ref %Point = temporary invalid, %Point.val [concrete]
  254. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  255. // CHECK:STDOUT: }
  256. // CHECK:STDOUT:
  257. // CHECK:STDOUT: imports {
  258. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  259. // CHECK:STDOUT: .Destroy = %Core.Destroy
  260. // CHECK:STDOUT: import Core//prelude
  261. // CHECK:STDOUT: import Core//prelude/...
  262. // CHECK:STDOUT: }
  263. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT:
  266. // CHECK:STDOUT: file {
  267. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  268. // CHECK:STDOUT: .Core = imports.%Core
  269. // CHECK:STDOUT: .Z = %Z.decl
  270. // CHECK:STDOUT: .Point = %Point.decl
  271. // CHECK:STDOUT: .F = %F.decl
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT: %Core.import = import Core
  274. // CHECK:STDOUT: %Z.decl: type = interface_decl @Z [concrete = constants.%Z.type] {} {}
  275. // CHECK:STDOUT: %Point.decl: type = class_decl @Point [concrete = constants.%Point] {} {}
  276. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  277. // CHECK:STDOUT: }
  278. // CHECK:STDOUT:
  279. // CHECK:STDOUT: interface @Z {
  280. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.c59]
  281. // CHECK:STDOUT: %Z.WithSelf.decl = interface_with_self_decl @Z [concrete]
  282. // CHECK:STDOUT:
  283. // CHECK:STDOUT: !with Self:
  284. // CHECK:STDOUT: %Z.WithSelf.Zero.decl: @Z.WithSelf.%Z.WithSelf.Zero.type (%Z.WithSelf.Zero.type.e4a) = fn_decl @Z.WithSelf.Zero [symbolic = @Z.WithSelf.%Z.WithSelf.Zero (constants.%Z.WithSelf.Zero.3f4)] {} {}
  285. // CHECK:STDOUT: %assoc0: %Z.assoc_type = assoc_entity element0, %Z.WithSelf.Zero.decl [concrete = constants.%assoc0.cc0]
  286. // CHECK:STDOUT: %Z.WithSelf.Method.decl: @Z.WithSelf.%Z.WithSelf.Method.type (%Z.WithSelf.Method.type.dfd) = fn_decl @Z.WithSelf.Method [symbolic = @Z.WithSelf.%Z.WithSelf.Method (constants.%Z.WithSelf.Method.324)] {
  287. // CHECK:STDOUT: %self.param_patt: @Z.WithSelf.Method.%pattern_type (%pattern_type.84b) = value_param_pattern [concrete]
  288. // CHECK:STDOUT: %self.patt: @Z.WithSelf.Method.%pattern_type (%pattern_type.84b) = at_binding_pattern self, %self.param_patt [concrete]
  289. // CHECK:STDOUT: } {
  290. // CHECK:STDOUT: %self.param: @Z.WithSelf.Method.%Self.binding.as_type (%Self.binding.as_type.62d) = value_param call_param0
  291. // CHECK:STDOUT: %.loc5_19.1: type = splice_block %.loc5_19.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.62d)] {
  292. // CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self.c59)]
  293. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.62d)]
  294. // CHECK:STDOUT: %.loc5_19.2: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.62d)]
  295. // CHECK:STDOUT: }
  296. // CHECK:STDOUT: %self: @Z.WithSelf.Method.%Self.binding.as_type (%Self.binding.as_type.62d) = value_binding self, %self.param
  297. // CHECK:STDOUT: }
  298. // CHECK:STDOUT: %assoc1: %Z.assoc_type = assoc_entity element1, %Z.WithSelf.Method.decl [concrete = constants.%assoc1]
  299. // CHECK:STDOUT: impl_decl @<error>.as.Z.impl [concrete] {} {
  300. // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
  301. // CHECK:STDOUT: }
  302. // CHECK:STDOUT:
  303. // CHECK:STDOUT: !members:
  304. // CHECK:STDOUT: .Self = %Self
  305. // CHECK:STDOUT: .Z = <poisoned>
  306. // CHECK:STDOUT: .Zero = @Z.WithSelf.%assoc0
  307. // CHECK:STDOUT: .Method = @Z.WithSelf.%assoc1
  308. // CHECK:STDOUT: .Z = <poisoned>
  309. // CHECK:STDOUT: witness = (@Z.WithSelf.%Z.WithSelf.Zero.decl, @Z.WithSelf.%Z.WithSelf.Method.decl)
  310. // CHECK:STDOUT:
  311. // CHECK:STDOUT: !requires:
  312. // CHECK:STDOUT: }
  313. // CHECK:STDOUT:
  314. // CHECK:STDOUT: generic impl @<error>.as.Z.impl(@Z.%Self: %Z.type) {
  315. // CHECK:STDOUT: !definition:
  316. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.c59)]
  317. // CHECK:STDOUT: %<error>.as.Z.impl.Zero.type: type = fn_type @<error>.as.Z.impl.Zero, @<error>.as.Z.impl(%Self) [symbolic = %<error>.as.Z.impl.Zero.type (constants.%<error>.as.Z.impl.Zero.type)]
  318. // CHECK:STDOUT: %<error>.as.Z.impl.Zero: @<error>.as.Z.impl.%<error>.as.Z.impl.Zero.type (%<error>.as.Z.impl.Zero.type) = struct_value () [symbolic = %<error>.as.Z.impl.Zero (constants.%<error>.as.Z.impl.Zero)]
  319. // CHECK:STDOUT: %<error>.as.Z.impl.Method.type: type = fn_type @<error>.as.Z.impl.Method, @<error>.as.Z.impl(%Self) [symbolic = %<error>.as.Z.impl.Method.type (constants.%<error>.as.Z.impl.Method.type)]
  320. // CHECK:STDOUT: %<error>.as.Z.impl.Method: @<error>.as.Z.impl.%<error>.as.Z.impl.Method.type (%<error>.as.Z.impl.Method.type) = struct_value () [symbolic = %<error>.as.Z.impl.Method (constants.%<error>.as.Z.impl.Method)]
  321. // CHECK:STDOUT:
  322. // CHECK:STDOUT: impl: <error> as %Z.ref {
  323. // CHECK:STDOUT: %<error>.as.Z.impl.Zero.decl: @<error>.as.Z.impl.%<error>.as.Z.impl.Zero.type (%<error>.as.Z.impl.Zero.type) = fn_decl @<error>.as.Z.impl.Zero [symbolic = @<error>.as.Z.impl.%<error>.as.Z.impl.Zero (constants.%<error>.as.Z.impl.Zero)] {} {}
  324. // CHECK:STDOUT: %<error>.as.Z.impl.Method.decl: @<error>.as.Z.impl.%<error>.as.Z.impl.Method.type (%<error>.as.Z.impl.Method.type) = fn_decl @<error>.as.Z.impl.Method [symbolic = @<error>.as.Z.impl.%<error>.as.Z.impl.Method (constants.%<error>.as.Z.impl.Method)] {
  325. // CHECK:STDOUT: %self.param_patt: @<error>.as.Z.impl.Method.%pattern_type (%pattern_type.84b) = value_param_pattern [concrete]
  326. // CHECK:STDOUT: %self.patt: @<error>.as.Z.impl.Method.%pattern_type (%pattern_type.84b) = at_binding_pattern self, %self.param_patt [concrete]
  327. // CHECK:STDOUT: } {
  328. // CHECK:STDOUT: %self.param: @<error>.as.Z.impl.Method.%Self.binding.as_type (%Self.binding.as_type.62d) = value_param call_param0
  329. // CHECK:STDOUT: %.loc13_28.1: type = splice_block %.loc13_28.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.62d)] {
  330. // CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self.c59)]
  331. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.62d)]
  332. // CHECK:STDOUT: %.loc13_28.2: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.62d)]
  333. // CHECK:STDOUT: }
  334. // CHECK:STDOUT: %self: @<error>.as.Z.impl.Method.%Self.binding.as_type (%Self.binding.as_type.62d) = value_binding self, %self.param
  335. // CHECK:STDOUT: }
  336. // CHECK:STDOUT:
  337. // CHECK:STDOUT: !members:
  338. // CHECK:STDOUT: .Zero = %<error>.as.Z.impl.Zero.decl
  339. // CHECK:STDOUT: .Method = %<error>.as.Z.impl.Method.decl
  340. // CHECK:STDOUT: witness = <error>
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT: }
  343. // CHECK:STDOUT:
  344. // CHECK:STDOUT: impl @Point.as.Z.impl: %Self.ref as %Z.ref {
  345. // CHECK:STDOUT: %Point.as.Z.impl.Zero.decl: %Point.as.Z.impl.Zero.type = fn_decl @Point.as.Z.impl.Zero [concrete = constants.%Point.as.Z.impl.Zero] {} {}
  346. // CHECK:STDOUT: %Point.as.Z.impl.Method.decl: %Point.as.Z.impl.Method.type = fn_decl @Point.as.Z.impl.Method [concrete = constants.%Point.as.Z.impl.Method] {
  347. // CHECK:STDOUT: %self.param_patt: %pattern_type.c86 = value_param_pattern [concrete]
  348. // CHECK:STDOUT: %self.patt: %pattern_type.c86 = at_binding_pattern self, %self.param_patt [concrete]
  349. // CHECK:STDOUT: } {
  350. // CHECK:STDOUT: %self.param: %Point = value_param call_param0
  351. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Point [concrete = constants.%Point]
  352. // CHECK:STDOUT: %self: %Point = value_binding self, %self.param
  353. // CHECK:STDOUT: }
  354. // CHECK:STDOUT: %Z.impl_witness_table = impl_witness_table (%Point.as.Z.impl.Zero.decl, %Point.as.Z.impl.Method.decl), @Point.as.Z.impl [concrete]
  355. // CHECK:STDOUT: %Z.impl_witness: <witness> = impl_witness %Z.impl_witness_table [concrete = constants.%Z.impl_witness]
  356. // CHECK:STDOUT:
  357. // CHECK:STDOUT: !members:
  358. // CHECK:STDOUT: .Zero = %Point.as.Z.impl.Zero.decl
  359. // CHECK:STDOUT: .Method = %Point.as.Z.impl.Method.decl
  360. // CHECK:STDOUT: witness = %Z.impl_witness
  361. // CHECK:STDOUT: }
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: class @Point {
  364. // CHECK:STDOUT: impl_decl @Point.as.Z.impl [concrete] {} {
  365. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Point [concrete = constants.%Point]
  366. // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
  367. // CHECK:STDOUT: }
  368. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  369. // CHECK:STDOUT: complete_type_witness = %complete_type
  370. // CHECK:STDOUT:
  371. // CHECK:STDOUT: !members:
  372. // CHECK:STDOUT: .Self = constants.%Point
  373. // CHECK:STDOUT: .Z = <poisoned>
  374. // CHECK:STDOUT: }
  375. // CHECK:STDOUT:
  376. // CHECK:STDOUT: generic fn @Z.WithSelf.Zero(@Z.%Self: %Z.type) {
  377. // CHECK:STDOUT: fn();
  378. // CHECK:STDOUT: }
  379. // CHECK:STDOUT:
  380. // CHECK:STDOUT: generic fn @Z.WithSelf.Method(@Z.%Self: %Z.type) {
  381. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.c59)]
  382. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.62d)]
  383. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.84b)]
  384. // CHECK:STDOUT:
  385. // CHECK:STDOUT: fn(%self.param: @Z.WithSelf.Method.%Self.binding.as_type (%Self.binding.as_type.62d));
  386. // CHECK:STDOUT: }
  387. // CHECK:STDOUT:
  388. // CHECK:STDOUT: generic fn @<error>.as.Z.impl.Zero(@Z.%Self: %Z.type) {
  389. // CHECK:STDOUT: !definition:
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: fn() {
  392. // CHECK:STDOUT: !entry:
  393. // CHECK:STDOUT: return
  394. // CHECK:STDOUT: }
  395. // CHECK:STDOUT: }
  396. // CHECK:STDOUT:
  397. // CHECK:STDOUT: generic fn @<error>.as.Z.impl.Method(@Z.%Self: %Z.type) {
  398. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.c59)]
  399. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.62d)]
  400. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.84b)]
  401. // CHECK:STDOUT:
  402. // CHECK:STDOUT: !definition:
  403. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %Self.binding.as_type [symbolic = %require_complete (constants.%require_complete)]
  404. // CHECK:STDOUT:
  405. // CHECK:STDOUT: fn(%self.param: @<error>.as.Z.impl.Method.%Self.binding.as_type (%Self.binding.as_type.62d)) {
  406. // CHECK:STDOUT: !entry:
  407. // CHECK:STDOUT: return
  408. // CHECK:STDOUT: }
  409. // CHECK:STDOUT: }
  410. // CHECK:STDOUT:
  411. // CHECK:STDOUT: fn @Point.as.Z.impl.Zero() {
  412. // CHECK:STDOUT: !entry:
  413. // CHECK:STDOUT: return
  414. // CHECK:STDOUT: }
  415. // CHECK:STDOUT:
  416. // CHECK:STDOUT: fn @Point.as.Z.impl.Method(%self.param: %Point) {
  417. // CHECK:STDOUT: !entry:
  418. // CHECK:STDOUT: return
  419. // CHECK:STDOUT: }
  420. // CHECK:STDOUT:
  421. // CHECK:STDOUT: fn @F() {
  422. // CHECK:STDOUT: !entry:
  423. // CHECK:STDOUT: %Point.ref.loc28: type = name_ref Point, file.%Point.decl [concrete = constants.%Point]
  424. // CHECK:STDOUT: %Z.ref.loc28: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
  425. // CHECK:STDOUT: %Zero.ref: %Z.assoc_type = name_ref Zero, @Z.WithSelf.%assoc0 [concrete = constants.%assoc0.cc0]
  426. // CHECK:STDOUT: %Z.facet: %Z.type = facet_value %Point.ref.loc28, (constants.%Z.impl_witness) [concrete = constants.%Z.facet]
  427. // CHECK:STDOUT: %.loc28: %Z.type = converted %Point.ref.loc28, %Z.facet [concrete = constants.%Z.facet]
  428. // CHECK:STDOUT: %impl.elem0: %.8c9 = impl_witness_access constants.%Z.impl_witness, element0 [concrete = constants.%Point.as.Z.impl.Zero]
  429. // CHECK:STDOUT: %Point.as.Z.impl.Zero.call: init %empty_tuple.type = call %impl.elem0()
  430. // CHECK:STDOUT: %.loc29_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  431. // CHECK:STDOUT: %Point.ref.loc29: type = name_ref Point, file.%Point.decl [concrete = constants.%Point]
  432. // CHECK:STDOUT: %.loc29_5.2: ref %Point = temporary_storage
  433. // CHECK:STDOUT: %.loc29_5.3: init %Point to %.loc29_5.2 = class_init () [concrete = constants.%Point.val]
  434. // CHECK:STDOUT: %.loc29_7.1: init %Point = converted %.loc29_5.1, %.loc29_5.3 [concrete = constants.%Point.val]
  435. // CHECK:STDOUT: %Z.ref.loc29: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
  436. // CHECK:STDOUT: %Method.ref: %Z.assoc_type = name_ref Method, @Z.WithSelf.%assoc1 [concrete = constants.%assoc1]
  437. // CHECK:STDOUT: %impl.elem1: %.429 = impl_witness_access constants.%Z.impl_witness, element1 [concrete = constants.%Point.as.Z.impl.Method]
  438. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %.loc29_7.1, %impl.elem1 [concrete = constants.%Point.as.Z.impl.Method.bound]
  439. // CHECK:STDOUT: %.loc29_7.2: ref %Point = temporary %.loc29_5.2, %.loc29_7.1 [concrete = constants.%.fcf]
  440. // CHECK:STDOUT: %.loc29_7.3: %Point = acquire_value %.loc29_7.2 [concrete = constants.%Point.val]
  441. // CHECK:STDOUT: %Point.as.Z.impl.Method.call: init %empty_tuple.type = call %bound_method(%.loc29_7.3)
  442. // CHECK:STDOUT: return
  443. // CHECK:STDOUT: }
  444. // CHECK:STDOUT:
  445. // CHECK:STDOUT: fn @Destroy.Op(%self.param: ref %Point) = "no_op";
  446. // CHECK:STDOUT:
  447. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.c59) {
  448. // CHECK:STDOUT: !definition:
  449. // CHECK:STDOUT: %Self => constants.%Self.c59
  450. // CHECK:STDOUT: %Z.WithSelf.Zero.type => constants.%Z.WithSelf.Zero.type.e4a
  451. // CHECK:STDOUT: %Z.WithSelf.Zero => constants.%Z.WithSelf.Zero.3f4
  452. // CHECK:STDOUT: %Z.WithSelf.Method.type => constants.%Z.WithSelf.Method.type.dfd
  453. // CHECK:STDOUT: %Z.WithSelf.Method => constants.%Z.WithSelf.Method.324
  454. // CHECK:STDOUT: }
  455. // CHECK:STDOUT:
  456. // CHECK:STDOUT: specific @Z.WithSelf.Zero(constants.%Self.c59) {}
  457. // CHECK:STDOUT:
  458. // CHECK:STDOUT: specific @Z.WithSelf.Method(constants.%Self.c59) {
  459. // CHECK:STDOUT: %Self => constants.%Self.c59
  460. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.62d
  461. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.84b
  462. // CHECK:STDOUT: }
  463. // CHECK:STDOUT:
  464. // CHECK:STDOUT: specific @<error>.as.Z.impl(constants.%Self.c59) {
  465. // CHECK:STDOUT: !definition:
  466. // CHECK:STDOUT: %Self => constants.%Self.c59
  467. // CHECK:STDOUT: %<error>.as.Z.impl.Zero.type => constants.%<error>.as.Z.impl.Zero.type
  468. // CHECK:STDOUT: %<error>.as.Z.impl.Zero => constants.%<error>.as.Z.impl.Zero
  469. // CHECK:STDOUT: %<error>.as.Z.impl.Method.type => constants.%<error>.as.Z.impl.Method.type
  470. // CHECK:STDOUT: %<error>.as.Z.impl.Method => constants.%<error>.as.Z.impl.Method
  471. // CHECK:STDOUT: }
  472. // CHECK:STDOUT:
  473. // CHECK:STDOUT: specific @<error>.as.Z.impl.Zero(constants.%Self.c59) {}
  474. // CHECK:STDOUT:
  475. // CHECK:STDOUT: specific @<error>.as.Z.impl.Method(constants.%Self.c59) {
  476. // CHECK:STDOUT: %Self => constants.%Self.c59
  477. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.62d
  478. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.84b
  479. // CHECK:STDOUT: }
  480. // CHECK:STDOUT:
  481. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Z.facet) {
  482. // CHECK:STDOUT: !definition:
  483. // CHECK:STDOUT: %Self => constants.%Z.facet
  484. // CHECK:STDOUT: %Z.WithSelf.Zero.type => constants.%Z.WithSelf.Zero.type.949
  485. // CHECK:STDOUT: %Z.WithSelf.Zero => constants.%Z.WithSelf.Zero.3ae
  486. // CHECK:STDOUT: %Z.WithSelf.Method.type => constants.%Z.WithSelf.Method.type.707
  487. // CHECK:STDOUT: %Z.WithSelf.Method => constants.%Z.WithSelf.Method.74d
  488. // CHECK:STDOUT: }
  489. // CHECK:STDOUT:
  490. // CHECK:STDOUT: specific @Z.WithSelf.Zero(constants.%Z.facet) {}
  491. // CHECK:STDOUT:
  492. // CHECK:STDOUT: specific @Z.WithSelf.Method(constants.%Z.facet) {
  493. // CHECK:STDOUT: %Self => constants.%Z.facet
  494. // CHECK:STDOUT: %Self.binding.as_type => constants.%Point
  495. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.c86
  496. // CHECK:STDOUT: }
  497. // CHECK:STDOUT:
  498. // CHECK:STDOUT: --- fail_impl_as_other_interface.carbon
  499. // CHECK:STDOUT:
  500. // CHECK:STDOUT: constants {
  501. // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete]
  502. // CHECK:STDOUT: %Self.c51: %A.type = symbolic_binding Self, 0 [symbolic]
  503. // CHECK:STDOUT: %A.WithSelf.B.type.386: type = fn_type @A.WithSelf.B, @A.WithSelf(%Self.c51) [symbolic]
  504. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  505. // CHECK:STDOUT: %A.WithSelf.B.b88: %A.WithSelf.B.type.386 = struct_value () [symbolic]
  506. // CHECK:STDOUT: %A.assoc_type: type = assoc_entity_type @A [concrete]
  507. // CHECK:STDOUT: %assoc0: %A.assoc_type = assoc_entity element0, @A.WithSelf.%A.WithSelf.B.decl [concrete]
  508. // CHECK:STDOUT: %C.type: type = facet_type <@C> [concrete]
  509. // CHECK:STDOUT: %Self.b7c: %C.type = symbolic_binding Self, 0 [symbolic]
  510. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  511. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  512. // CHECK:STDOUT: %X: type = class_type @X [concrete]
  513. // CHECK:STDOUT: %A.impl_witness: <witness> = impl_witness @X.as.A.impl.%A.impl_witness_table [concrete]
  514. // CHECK:STDOUT: %X.as.A.impl.B.type: type = fn_type @X.as.A.impl.B [concrete]
  515. // CHECK:STDOUT: %X.as.A.impl.B: %X.as.A.impl.B.type = struct_value () [concrete]
  516. // CHECK:STDOUT: %A.facet: %A.type = facet_value %X, (%A.impl_witness) [concrete]
  517. // CHECK:STDOUT: %A.WithSelf.B.type.c6b: type = fn_type @A.WithSelf.B, @A.WithSelf(%A.facet) [concrete]
  518. // CHECK:STDOUT: %A.WithSelf.B.f2a: %A.WithSelf.B.type.c6b = struct_value () [concrete]
  519. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  520. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  521. // CHECK:STDOUT: }
  522. // CHECK:STDOUT:
  523. // CHECK:STDOUT: imports {
  524. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  525. // CHECK:STDOUT: import Core//prelude
  526. // CHECK:STDOUT: import Core//prelude/...
  527. // CHECK:STDOUT: }
  528. // CHECK:STDOUT: }
  529. // CHECK:STDOUT:
  530. // CHECK:STDOUT: file {
  531. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  532. // CHECK:STDOUT: .Core = imports.%Core
  533. // CHECK:STDOUT: .A = %A.decl
  534. // CHECK:STDOUT: .C = %C.decl
  535. // CHECK:STDOUT: .G = %G.decl
  536. // CHECK:STDOUT: .X = %X.decl
  537. // CHECK:STDOUT: }
  538. // CHECK:STDOUT: %Core.import = import Core
  539. // CHECK:STDOUT: %A.decl: type = interface_decl @A [concrete = constants.%A.type] {} {}
  540. // CHECK:STDOUT: %C.decl: type = interface_decl @C [concrete = constants.%C.type] {} {}
  541. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {}
  542. // CHECK:STDOUT: %X.decl: type = class_decl @X [concrete = constants.%X] {} {}
  543. // CHECK:STDOUT: }
  544. // CHECK:STDOUT:
  545. // CHECK:STDOUT: interface @A {
  546. // CHECK:STDOUT: %Self: %A.type = symbolic_binding Self, 0 [symbolic = constants.%Self.c51]
  547. // CHECK:STDOUT: %A.WithSelf.decl = interface_with_self_decl @A [concrete]
  548. // CHECK:STDOUT:
  549. // CHECK:STDOUT: !with Self:
  550. // CHECK:STDOUT: %A.WithSelf.B.decl: @A.WithSelf.%A.WithSelf.B.type (%A.WithSelf.B.type.386) = fn_decl @A.WithSelf.B [symbolic = @A.WithSelf.%A.WithSelf.B (constants.%A.WithSelf.B.b88)] {} {}
  551. // CHECK:STDOUT: %assoc0: %A.assoc_type = assoc_entity element0, %A.WithSelf.B.decl [concrete = constants.%assoc0]
  552. // CHECK:STDOUT:
  553. // CHECK:STDOUT: !members:
  554. // CHECK:STDOUT: .Self = %Self
  555. // CHECK:STDOUT: .B = @A.WithSelf.%assoc0
  556. // CHECK:STDOUT: witness = (@A.WithSelf.%A.WithSelf.B.decl)
  557. // CHECK:STDOUT:
  558. // CHECK:STDOUT: !requires:
  559. // CHECK:STDOUT: }
  560. // CHECK:STDOUT:
  561. // CHECK:STDOUT: interface @C {
  562. // CHECK:STDOUT: %Self: %C.type = symbolic_binding Self, 0 [symbolic = constants.%Self.b7c]
  563. // CHECK:STDOUT: %C.WithSelf.decl = interface_with_self_decl @C [concrete]
  564. // CHECK:STDOUT:
  565. // CHECK:STDOUT: !members:
  566. // CHECK:STDOUT: .Self = %Self
  567. // CHECK:STDOUT: witness = ()
  568. // CHECK:STDOUT:
  569. // CHECK:STDOUT: !requires:
  570. // CHECK:STDOUT: }
  571. // CHECK:STDOUT:
  572. // CHECK:STDOUT: impl @X.as.A.impl: %Self.ref as %A.ref {
  573. // CHECK:STDOUT: impl_decl @<error>.as.C.impl [concrete] {} {
  574. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C.type]
  575. // CHECK:STDOUT: }
  576. // CHECK:STDOUT: %X.as.A.impl.B.decl: %X.as.A.impl.B.type = fn_decl @X.as.A.impl.B [concrete = constants.%X.as.A.impl.B] {} {}
  577. // CHECK:STDOUT: %A.impl_witness_table = impl_witness_table (%X.as.A.impl.B.decl), @X.as.A.impl [concrete]
  578. // CHECK:STDOUT: %A.impl_witness: <witness> = impl_witness %A.impl_witness_table [concrete = constants.%A.impl_witness]
  579. // CHECK:STDOUT:
  580. // CHECK:STDOUT: !members:
  581. // CHECK:STDOUT: .C = <poisoned>
  582. // CHECK:STDOUT: .B = %X.as.A.impl.B.decl
  583. // CHECK:STDOUT: .G = <poisoned>
  584. // CHECK:STDOUT: witness = %A.impl_witness
  585. // CHECK:STDOUT: }
  586. // CHECK:STDOUT:
  587. // CHECK:STDOUT: impl @<error>.as.C.impl: <error> as %C.ref {
  588. // CHECK:STDOUT: !members:
  589. // CHECK:STDOUT: witness = <error>
  590. // CHECK:STDOUT: }
  591. // CHECK:STDOUT:
  592. // CHECK:STDOUT: class @X {
  593. // CHECK:STDOUT: impl_decl @X.as.A.impl [concrete] {} {
  594. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%X [concrete = constants.%X]
  595. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type]
  596. // CHECK:STDOUT: }
  597. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  598. // CHECK:STDOUT: complete_type_witness = %complete_type
  599. // CHECK:STDOUT:
  600. // CHECK:STDOUT: !members:
  601. // CHECK:STDOUT: .Self = constants.%X
  602. // CHECK:STDOUT: .A = <poisoned>
  603. // CHECK:STDOUT: .C = <poisoned>
  604. // CHECK:STDOUT: .G = <poisoned>
  605. // CHECK:STDOUT: }
  606. // CHECK:STDOUT:
  607. // CHECK:STDOUT: generic fn @A.WithSelf.B(@A.%Self: %A.type) {
  608. // CHECK:STDOUT: fn();
  609. // CHECK:STDOUT: }
  610. // CHECK:STDOUT:
  611. // CHECK:STDOUT: fn @G() {
  612. // CHECK:STDOUT: !entry:
  613. // CHECK:STDOUT: return
  614. // CHECK:STDOUT: }
  615. // CHECK:STDOUT:
  616. // CHECK:STDOUT: fn @X.as.A.impl.B() {
  617. // CHECK:STDOUT: !entry:
  618. // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G]
  619. // CHECK:STDOUT: %G.call: init %empty_tuple.type = call %G.ref()
  620. // CHECK:STDOUT: return
  621. // CHECK:STDOUT: }
  622. // CHECK:STDOUT:
  623. // CHECK:STDOUT: specific @A.WithSelf(constants.%Self.c51) {
  624. // CHECK:STDOUT: !definition:
  625. // CHECK:STDOUT: %Self => constants.%Self.c51
  626. // CHECK:STDOUT: %A.WithSelf.B.type => constants.%A.WithSelf.B.type.386
  627. // CHECK:STDOUT: %A.WithSelf.B => constants.%A.WithSelf.B.b88
  628. // CHECK:STDOUT: }
  629. // CHECK:STDOUT:
  630. // CHECK:STDOUT: specific @A.WithSelf.B(constants.%Self.c51) {}
  631. // CHECK:STDOUT:
  632. // CHECK:STDOUT: specific @C.WithSelf(constants.%Self.b7c) {}
  633. // CHECK:STDOUT:
  634. // CHECK:STDOUT: specific @A.WithSelf(constants.%A.facet) {
  635. // CHECK:STDOUT: !definition:
  636. // CHECK:STDOUT: %Self => constants.%A.facet
  637. // CHECK:STDOUT: %A.WithSelf.B.type => constants.%A.WithSelf.B.type.c6b
  638. // CHECK:STDOUT: %A.WithSelf.B => constants.%A.WithSelf.B.f2a
  639. // CHECK:STDOUT: }
  640. // CHECK:STDOUT:
  641. // CHECK:STDOUT: specific @A.WithSelf.B(constants.%A.facet) {}
  642. // CHECK:STDOUT: