deduce_nested_facet_value.carbon 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  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/facet_types.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/function/generic/deduce_nested_facet_value.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/generic/deduce_nested_facet_value.carbon
  14. // --- deduce_nested_facet_value.carbon
  15. library "[[@TEST_NAME]]";
  16. interface Y {}
  17. interface W {}
  18. // DD implements both Y and W.
  19. class DD {}
  20. impl DD as Y {}
  21. impl DD as W {}
  22. // CC requires D to implement Y.
  23. class CC(D:! Y) {}
  24. interface Z {}
  25. // The `D` interface provides `Y` but not `W`, so we need to see that the
  26. // parameter to `CC` is `DD` which provides `Y & W`, not just a FacetValue
  27. // abstractly providing `Y.
  28. impl forall [E:! Y & W] CC(E) as Z {}
  29. fn F() {
  30. (CC(DD)) as Z;
  31. }
  32. // CHECK:STDOUT: --- deduce_nested_facet_value.carbon
  33. // CHECK:STDOUT:
  34. // CHECK:STDOUT: constants {
  35. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  36. // CHECK:STDOUT: %Self.b29: %Y.type = bind_symbolic_name Self, 0 [symbolic]
  37. // CHECK:STDOUT: %W.type: type = facet_type <@W> [concrete]
  38. // CHECK:STDOUT: %Self.f12: %W.type = bind_symbolic_name Self, 0 [symbolic]
  39. // CHECK:STDOUT: %DD: type = class_type @DD [concrete]
  40. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  41. // CHECK:STDOUT: %pattern_type.f6d: type = pattern_type auto [concrete]
  42. // CHECK:STDOUT: %Destroy.impl_witness.147: <witness> = impl_witness @DD.%Destroy.impl_witness_table [concrete]
  43. // CHECK:STDOUT: %ptr.3d1: type = ptr_type %DD [concrete]
  44. // CHECK:STDOUT: %pattern_type.3fc: type = pattern_type %ptr.3d1 [concrete]
  45. // CHECK:STDOUT: %DD.as.Destroy.impl.Op.type: type = fn_type @DD.as.Destroy.impl.Op [concrete]
  46. // CHECK:STDOUT: %DD.as.Destroy.impl.Op: %DD.as.Destroy.impl.Op.type = struct_value () [concrete]
  47. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  48. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  49. // CHECK:STDOUT: %Y.impl_witness: <witness> = impl_witness file.%Y.impl_witness_table [concrete]
  50. // CHECK:STDOUT: %W.impl_witness: <witness> = impl_witness file.%W.impl_witness_table [concrete]
  51. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic_self]
  52. // CHECK:STDOUT: %D: %Y.type = bind_symbolic_name D, 0 [symbolic]
  53. // CHECK:STDOUT: %pattern_type.667: type = pattern_type %Y.type [concrete]
  54. // CHECK:STDOUT: %CC.type: type = generic_class_type @CC [concrete]
  55. // CHECK:STDOUT: %CC.generic: %CC.type = struct_value () [concrete]
  56. // CHECK:STDOUT: %CC.3ba: type = class_type @CC, @CC(%D) [symbolic]
  57. // CHECK:STDOUT: %Destroy.impl_witness.a11: <witness> = impl_witness @CC.%Destroy.impl_witness_table, @CC.as.Destroy.impl(%D) [symbolic]
  58. // CHECK:STDOUT: %ptr.423: type = ptr_type %CC.3ba [symbolic]
  59. // CHECK:STDOUT: %pattern_type.1ed: type = pattern_type %ptr.423 [symbolic]
  60. // CHECK:STDOUT: %CC.as.Destroy.impl.Op.type: type = fn_type @CC.as.Destroy.impl.Op, @CC.as.Destroy.impl(%D) [symbolic]
  61. // CHECK:STDOUT: %CC.as.Destroy.impl.Op: %CC.as.Destroy.impl.Op.type = struct_value () [symbolic]
  62. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  63. // CHECK:STDOUT: %Self.6e6: %Z.type = bind_symbolic_name Self, 0 [symbolic]
  64. // CHECK:STDOUT: %BitAndWith.type.f2e: type = generic_interface_type @BitAndWith [concrete]
  65. // CHECK:STDOUT: %BitAndWith.generic: %BitAndWith.type.f2e = struct_value () [concrete]
  66. // CHECK:STDOUT: %BitAndWith.type.e8c: type = facet_type <@BitAndWith, @BitAndWith(type)> [concrete]
  67. // CHECK:STDOUT: %BitAndWith.Op.type.9a3: type = fn_type @BitAndWith.Op, @BitAndWith(type) [concrete]
  68. // CHECK:STDOUT: %BitAndWith.impl_witness: <witness> = impl_witness imports.%BitAndWith.impl_witness_table [concrete]
  69. // CHECK:STDOUT: %BitAndWith.facet: %BitAndWith.type.e8c = facet_value type, (%BitAndWith.impl_witness) [concrete]
  70. // CHECK:STDOUT: %.2af: type = fn_type_with_self_type %BitAndWith.Op.type.9a3, %BitAndWith.facet [concrete]
  71. // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.type: type = fn_type @type.as.BitAndWith.impl.Op [concrete]
  72. // CHECK:STDOUT: %type.as.BitAndWith.impl.Op: %type.as.BitAndWith.impl.Op.type = struct_value () [concrete]
  73. // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.bound: <bound method> = bound_method %Y.type, %type.as.BitAndWith.impl.Op [concrete]
  74. // CHECK:STDOUT: %facet_type: type = facet_type <@Y & @W> [concrete]
  75. // CHECK:STDOUT: %E: %facet_type = bind_symbolic_name E, 0 [symbolic]
  76. // CHECK:STDOUT: %pattern_type.122: type = pattern_type %facet_type [concrete]
  77. // CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %E, @Y [symbolic]
  78. // CHECK:STDOUT: %E.as_type: type = facet_access_type %E [symbolic]
  79. // CHECK:STDOUT: %Y.facet.7ec: %Y.type = facet_value %E.as_type, (%Y.lookup_impl_witness) [symbolic]
  80. // CHECK:STDOUT: %CC.d02: type = class_type @CC, @CC(%Y.facet.7ec) [symbolic]
  81. // CHECK:STDOUT: %Z.impl_witness.741: <witness> = impl_witness file.%Z.impl_witness_table, @CC.as.Z.impl(%E) [symbolic]
  82. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  83. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  84. // CHECK:STDOUT: %Y.facet.268: %Y.type = facet_value %DD, (%Y.impl_witness) [concrete]
  85. // CHECK:STDOUT: %CC.7bf: type = class_type @CC, @CC(%Y.facet.268) [concrete]
  86. // CHECK:STDOUT: %facet_value: %facet_type = facet_value %DD, (%Y.impl_witness, %W.impl_witness) [concrete]
  87. // CHECK:STDOUT: %Z.impl_witness.3b0: <witness> = impl_witness file.%Z.impl_witness_table, @CC.as.Z.impl(%facet_value) [concrete]
  88. // CHECK:STDOUT: %Z.facet: %Z.type = facet_value %CC.7bf, (%Z.impl_witness.3b0) [concrete]
  89. // CHECK:STDOUT: }
  90. // CHECK:STDOUT:
  91. // CHECK:STDOUT: imports {
  92. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  93. // CHECK:STDOUT: .Destroy = %Core.Destroy
  94. // CHECK:STDOUT: .BitAndWith = %Core.BitAndWith
  95. // CHECK:STDOUT: import Core//prelude
  96. // CHECK:STDOUT: import Core//prelude/...
  97. // CHECK:STDOUT: }
  98. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  99. // CHECK:STDOUT: %Core.BitAndWith: %BitAndWith.type.f2e = import_ref Core//prelude, BitAndWith, loaded [concrete = constants.%BitAndWith.generic]
  100. // CHECK:STDOUT: %Core.import_ref.012: %type.as.BitAndWith.impl.Op.type = import_ref Core//prelude, loc13_42, loaded [concrete = constants.%type.as.BitAndWith.impl.Op]
  101. // CHECK:STDOUT: %BitAndWith.impl_witness_table = impl_witness_table (%Core.import_ref.012), @type.as.BitAndWith.impl [concrete]
  102. // CHECK:STDOUT: }
  103. // CHECK:STDOUT:
  104. // CHECK:STDOUT: file {
  105. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  106. // CHECK:STDOUT: .Core = imports.%Core
  107. // CHECK:STDOUT: .Y = %Y.decl
  108. // CHECK:STDOUT: .W = %W.decl
  109. // CHECK:STDOUT: .DD = %DD.decl
  110. // CHECK:STDOUT: .CC = %CC.decl
  111. // CHECK:STDOUT: .Z = %Z.decl
  112. // CHECK:STDOUT: .F = %F.decl
  113. // CHECK:STDOUT: }
  114. // CHECK:STDOUT: %Core.import = import Core
  115. // CHECK:STDOUT: %Y.decl: type = interface_decl @Y [concrete = constants.%Y.type] {} {}
  116. // CHECK:STDOUT: %W.decl: type = interface_decl @W [concrete = constants.%W.type] {} {}
  117. // CHECK:STDOUT: %DD.decl: type = class_decl @DD [concrete = constants.%DD] {} {}
  118. // CHECK:STDOUT: impl_decl @DD.as.Y.impl [concrete] {} {
  119. // CHECK:STDOUT: %DD.ref: type = name_ref DD, file.%DD.decl [concrete = constants.%DD]
  120. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  121. // CHECK:STDOUT: }
  122. // CHECK:STDOUT: %Y.impl_witness_table = impl_witness_table (), @DD.as.Y.impl [concrete]
  123. // CHECK:STDOUT: %Y.impl_witness: <witness> = impl_witness %Y.impl_witness_table [concrete = constants.%Y.impl_witness]
  124. // CHECK:STDOUT: impl_decl @DD.as.W.impl [concrete] {} {
  125. // CHECK:STDOUT: %DD.ref: type = name_ref DD, file.%DD.decl [concrete = constants.%DD]
  126. // CHECK:STDOUT: %W.ref: type = name_ref W, file.%W.decl [concrete = constants.%W.type]
  127. // CHECK:STDOUT: }
  128. // CHECK:STDOUT: %W.impl_witness_table = impl_witness_table (), @DD.as.W.impl [concrete]
  129. // CHECK:STDOUT: %W.impl_witness: <witness> = impl_witness %W.impl_witness_table [concrete = constants.%W.impl_witness]
  130. // CHECK:STDOUT: %CC.decl: %CC.type = class_decl @CC [concrete = constants.%CC.generic] {
  131. // CHECK:STDOUT: %D.patt: %pattern_type.667 = symbolic_binding_pattern D, 0 [concrete]
  132. // CHECK:STDOUT: } {
  133. // CHECK:STDOUT: %.loc12: type = splice_block %Y.ref [concrete = constants.%Y.type] {
  134. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  135. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  136. // CHECK:STDOUT: }
  137. // CHECK:STDOUT: %D.loc12_10.2: %Y.type = bind_symbolic_name D, 0 [symbolic = %D.loc12_10.1 (constants.%D)]
  138. // CHECK:STDOUT: }
  139. // CHECK:STDOUT: %Z.decl: type = interface_decl @Z [concrete = constants.%Z.type] {} {}
  140. // CHECK:STDOUT: impl_decl @CC.as.Z.impl [concrete] {
  141. // CHECK:STDOUT: %E.patt: %pattern_type.122 = symbolic_binding_pattern E, 0 [concrete]
  142. // CHECK:STDOUT: } {
  143. // CHECK:STDOUT: %CC.ref: %CC.type = name_ref CC, file.%CC.decl [concrete = constants.%CC.generic]
  144. // CHECK:STDOUT: %E.ref: %facet_type = name_ref E, %E.loc19_14.1 [symbolic = %E.loc19_14.2 (constants.%E)]
  145. // CHECK:STDOUT: %E.as_type.loc19_29.1: type = facet_access_type constants.%E [symbolic = %E.as_type.loc19_29.2 (constants.%E.as_type)]
  146. // CHECK:STDOUT: %Y.facet.loc19_29.1: %Y.type = facet_value %E.as_type.loc19_29.1, (constants.%Y.lookup_impl_witness) [symbolic = %Y.facet.loc19_29.2 (constants.%Y.facet.7ec)]
  147. // CHECK:STDOUT: %.loc19_29: %Y.type = converted %E.ref, %Y.facet.loc19_29.1 [symbolic = %Y.facet.loc19_29.2 (constants.%Y.facet.7ec)]
  148. // CHECK:STDOUT: %CC.loc19_29.1: type = class_type @CC, @CC(constants.%Y.facet.7ec) [symbolic = %CC.loc19_29.2 (constants.%CC.d02)]
  149. // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
  150. // CHECK:STDOUT: %.loc19_20.1: type = splice_block %.loc19_20.3 [concrete = constants.%facet_type] {
  151. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  152. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  153. // CHECK:STDOUT: %W.ref: type = name_ref W, file.%W.decl [concrete = constants.%W.type]
  154. // CHECK:STDOUT: %impl.elem0: %.2af = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op]
  155. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %Y.ref, %impl.elem0 [concrete = constants.%type.as.BitAndWith.impl.Op.bound]
  156. // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call: init type = call %bound_method(%Y.ref, %W.ref) [concrete = constants.%facet_type]
  157. // CHECK:STDOUT: %.loc19_20.2: type = value_of_initializer %type.as.BitAndWith.impl.Op.call [concrete = constants.%facet_type]
  158. // CHECK:STDOUT: %.loc19_20.3: type = converted %type.as.BitAndWith.impl.Op.call, %.loc19_20.2 [concrete = constants.%facet_type]
  159. // CHECK:STDOUT: }
  160. // CHECK:STDOUT: %E.loc19_14.1: %facet_type = bind_symbolic_name E, 0 [symbolic = %E.loc19_14.2 (constants.%E)]
  161. // CHECK:STDOUT: }
  162. // CHECK:STDOUT: %Z.impl_witness_table = impl_witness_table (), @CC.as.Z.impl [concrete]
  163. // CHECK:STDOUT: %Z.impl_witness: <witness> = impl_witness %Z.impl_witness_table, @CC.as.Z.impl(constants.%E) [symbolic = @CC.as.Z.impl.%Z.impl_witness (constants.%Z.impl_witness.741)]
  164. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  165. // CHECK:STDOUT: }
  166. // CHECK:STDOUT:
  167. // CHECK:STDOUT: interface @Y {
  168. // CHECK:STDOUT: %Self: %Y.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.b29]
  169. // CHECK:STDOUT:
  170. // CHECK:STDOUT: !members:
  171. // CHECK:STDOUT: .Self = %Self
  172. // CHECK:STDOUT: witness = ()
  173. // CHECK:STDOUT: }
  174. // CHECK:STDOUT:
  175. // CHECK:STDOUT: interface @W {
  176. // CHECK:STDOUT: %Self: %W.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.f12]
  177. // CHECK:STDOUT:
  178. // CHECK:STDOUT: !members:
  179. // CHECK:STDOUT: .Self = %Self
  180. // CHECK:STDOUT: witness = ()
  181. // CHECK:STDOUT: }
  182. // CHECK:STDOUT:
  183. // CHECK:STDOUT: interface @Z {
  184. // CHECK:STDOUT: %Self: %Z.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.6e6]
  185. // CHECK:STDOUT:
  186. // CHECK:STDOUT: !members:
  187. // CHECK:STDOUT: .Self = %Self
  188. // CHECK:STDOUT: witness = ()
  189. // CHECK:STDOUT: }
  190. // CHECK:STDOUT:
  191. // CHECK:STDOUT: impl @DD.as.Destroy.impl: @DD.%Self.ref as constants.%Destroy.type {
  192. // CHECK:STDOUT: %DD.as.Destroy.impl.Op.decl: %DD.as.Destroy.impl.Op.type = fn_decl @DD.as.Destroy.impl.Op [concrete = constants.%DD.as.Destroy.impl.Op] {
  193. // CHECK:STDOUT: %self.patt: %pattern_type.3fc = binding_pattern self [concrete]
  194. // CHECK:STDOUT: %self.param_patt: %pattern_type.3fc = value_param_pattern %self.patt, call_param0 [concrete]
  195. // CHECK:STDOUT: %.loc7: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
  196. // CHECK:STDOUT: } {
  197. // CHECK:STDOUT: %self.param: %ptr.3d1 = value_param call_param0
  198. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%DD [concrete = constants.%DD]
  199. // CHECK:STDOUT: %self: %ptr.3d1 = bind_name self, %self.param
  200. // CHECK:STDOUT: }
  201. // CHECK:STDOUT:
  202. // CHECK:STDOUT: !members:
  203. // CHECK:STDOUT: .Op = %DD.as.Destroy.impl.Op.decl
  204. // CHECK:STDOUT: witness = @DD.%Destroy.impl_witness
  205. // CHECK:STDOUT: }
  206. // CHECK:STDOUT:
  207. // CHECK:STDOUT: impl @DD.as.Y.impl: %DD.ref as %Y.ref {
  208. // CHECK:STDOUT: !members:
  209. // CHECK:STDOUT: witness = file.%Y.impl_witness
  210. // CHECK:STDOUT: }
  211. // CHECK:STDOUT:
  212. // CHECK:STDOUT: impl @DD.as.W.impl: %DD.ref as %W.ref {
  213. // CHECK:STDOUT: !members:
  214. // CHECK:STDOUT: witness = file.%W.impl_witness
  215. // CHECK:STDOUT: }
  216. // CHECK:STDOUT:
  217. // CHECK:STDOUT: generic impl @CC.as.Destroy.impl(@CC.%D.loc12_10.2: %Y.type) {
  218. // CHECK:STDOUT: %D: %Y.type = bind_symbolic_name D, 0 [symbolic = %D (constants.%D)]
  219. // CHECK:STDOUT: %CC: type = class_type @CC, @CC(%D) [symbolic = %CC (constants.%CC.3ba)]
  220. // CHECK:STDOUT: %Destroy.impl_witness: <witness> = impl_witness @CC.%Destroy.impl_witness_table, @CC.as.Destroy.impl(%D) [symbolic = %Destroy.impl_witness (constants.%Destroy.impl_witness.a11)]
  221. // CHECK:STDOUT:
  222. // CHECK:STDOUT: !definition:
  223. // CHECK:STDOUT: %CC.as.Destroy.impl.Op.type: type = fn_type @CC.as.Destroy.impl.Op, @CC.as.Destroy.impl(%D) [symbolic = %CC.as.Destroy.impl.Op.type (constants.%CC.as.Destroy.impl.Op.type)]
  224. // CHECK:STDOUT: %CC.as.Destroy.impl.Op: @CC.as.Destroy.impl.%CC.as.Destroy.impl.Op.type (%CC.as.Destroy.impl.Op.type) = struct_value () [symbolic = %CC.as.Destroy.impl.Op (constants.%CC.as.Destroy.impl.Op)]
  225. // CHECK:STDOUT:
  226. // CHECK:STDOUT: impl: @CC.%Self.ref as constants.%Destroy.type {
  227. // CHECK:STDOUT: %CC.as.Destroy.impl.Op.decl: @CC.as.Destroy.impl.%CC.as.Destroy.impl.Op.type (%CC.as.Destroy.impl.Op.type) = fn_decl @CC.as.Destroy.impl.Op [symbolic = @CC.as.Destroy.impl.%CC.as.Destroy.impl.Op (constants.%CC.as.Destroy.impl.Op)] {
  228. // CHECK:STDOUT: %self.patt: @CC.as.Destroy.impl.Op.%pattern_type (%pattern_type.1ed) = binding_pattern self [concrete]
  229. // CHECK:STDOUT: %self.param_patt: @CC.as.Destroy.impl.Op.%pattern_type (%pattern_type.1ed) = value_param_pattern %self.patt, call_param0 [concrete]
  230. // CHECK:STDOUT: %.loc12_17.1: %pattern_type.f6d = addr_pattern %self.param_patt [concrete]
  231. // CHECK:STDOUT: } {
  232. // CHECK:STDOUT: %self.param: @CC.as.Destroy.impl.Op.%ptr (%ptr.423) = value_param call_param0
  233. // CHECK:STDOUT: %.loc12_17.2: type = splice_block %Self.ref [symbolic = %CC (constants.%CC.3ba)] {
  234. // CHECK:STDOUT: %.loc12_17.3: type = specific_constant constants.%CC.3ba, @CC(constants.%D) [symbolic = %CC (constants.%CC.3ba)]
  235. // CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc12_17.3 [symbolic = %CC (constants.%CC.3ba)]
  236. // CHECK:STDOUT: }
  237. // CHECK:STDOUT: %self: @CC.as.Destroy.impl.Op.%ptr (%ptr.423) = bind_name self, %self.param
  238. // CHECK:STDOUT: }
  239. // CHECK:STDOUT:
  240. // CHECK:STDOUT: !members:
  241. // CHECK:STDOUT: .Op = %CC.as.Destroy.impl.Op.decl
  242. // CHECK:STDOUT: witness = @CC.%Destroy.impl_witness
  243. // CHECK:STDOUT: }
  244. // CHECK:STDOUT: }
  245. // CHECK:STDOUT:
  246. // CHECK:STDOUT: generic impl @CC.as.Z.impl(%E.loc19_14.1: %facet_type) {
  247. // CHECK:STDOUT: %E.loc19_14.2: %facet_type = bind_symbolic_name E, 0 [symbolic = %E.loc19_14.2 (constants.%E)]
  248. // CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %E.loc19_14.2, @Y [symbolic = %Y.lookup_impl_witness (constants.%Y.lookup_impl_witness)]
  249. // CHECK:STDOUT: %E.as_type.loc19_29.2: type = facet_access_type %E.loc19_14.2 [symbolic = %E.as_type.loc19_29.2 (constants.%E.as_type)]
  250. // CHECK:STDOUT: %Y.facet.loc19_29.2: %Y.type = facet_value %E.as_type.loc19_29.2, (%Y.lookup_impl_witness) [symbolic = %Y.facet.loc19_29.2 (constants.%Y.facet.7ec)]
  251. // CHECK:STDOUT: %CC.loc19_29.2: type = class_type @CC, @CC(%Y.facet.loc19_29.2) [symbolic = %CC.loc19_29.2 (constants.%CC.d02)]
  252. // CHECK:STDOUT: %Z.impl_witness: <witness> = impl_witness file.%Z.impl_witness_table, @CC.as.Z.impl(%E.loc19_14.2) [symbolic = %Z.impl_witness (constants.%Z.impl_witness.741)]
  253. // CHECK:STDOUT:
  254. // CHECK:STDOUT: !definition:
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: impl: %CC.loc19_29.1 as %Z.ref {
  257. // CHECK:STDOUT: !members:
  258. // CHECK:STDOUT: witness = file.%Z.impl_witness
  259. // CHECK:STDOUT: }
  260. // CHECK:STDOUT: }
  261. // CHECK:STDOUT:
  262. // CHECK:STDOUT: class @DD {
  263. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%DD [concrete = constants.%DD]
  264. // CHECK:STDOUT: impl_decl @DD.as.Destroy.impl [concrete] {} {}
  265. // CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (@DD.as.Destroy.impl.%DD.as.Destroy.impl.Op.decl), @DD.as.Destroy.impl [concrete]
  266. // CHECK:STDOUT: %Destroy.impl_witness: <witness> = impl_witness %Destroy.impl_witness_table [concrete = constants.%Destroy.impl_witness.147]
  267. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  268. // CHECK:STDOUT: complete_type_witness = %complete_type
  269. // CHECK:STDOUT:
  270. // CHECK:STDOUT: !members:
  271. // CHECK:STDOUT: .Self = constants.%DD
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: generic class @CC(%D.loc12_10.2: %Y.type) {
  275. // CHECK:STDOUT: %D.loc12_10.1: %Y.type = bind_symbolic_name D, 0 [symbolic = %D.loc12_10.1 (constants.%D)]
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: !definition:
  278. // CHECK:STDOUT:
  279. // CHECK:STDOUT: class {
  280. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%CC.3ba [symbolic = @CC.as.Destroy.impl.%CC (constants.%CC.3ba)]
  281. // CHECK:STDOUT: impl_decl @CC.as.Destroy.impl [concrete] {} {}
  282. // CHECK:STDOUT: %Destroy.impl_witness_table = impl_witness_table (@CC.as.Destroy.impl.%CC.as.Destroy.impl.Op.decl), @CC.as.Destroy.impl [concrete]
  283. // CHECK:STDOUT: %Destroy.impl_witness: <witness> = impl_witness %Destroy.impl_witness_table, @CC.as.Destroy.impl(constants.%D) [symbolic = @CC.as.Destroy.impl.%Destroy.impl_witness (constants.%Destroy.impl_witness.a11)]
  284. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  285. // CHECK:STDOUT: complete_type_witness = %complete_type
  286. // CHECK:STDOUT:
  287. // CHECK:STDOUT: !members:
  288. // CHECK:STDOUT: .Self = constants.%CC.3ba
  289. // CHECK:STDOUT: }
  290. // CHECK:STDOUT: }
  291. // CHECK:STDOUT:
  292. // CHECK:STDOUT: fn @DD.as.Destroy.impl.Op(%self.param: %ptr.3d1) = "no_op";
  293. // CHECK:STDOUT:
  294. // CHECK:STDOUT: generic fn @CC.as.Destroy.impl.Op(@CC.%D.loc12_10.2: %Y.type) {
  295. // CHECK:STDOUT: %D: %Y.type = bind_symbolic_name D, 0 [symbolic = %D (constants.%D)]
  296. // CHECK:STDOUT: %CC: type = class_type @CC, @CC(%D) [symbolic = %CC (constants.%CC.3ba)]
  297. // CHECK:STDOUT: %ptr: type = ptr_type %CC [symbolic = %ptr (constants.%ptr.423)]
  298. // CHECK:STDOUT: %pattern_type: type = pattern_type %ptr [symbolic = %pattern_type (constants.%pattern_type.1ed)]
  299. // CHECK:STDOUT:
  300. // CHECK:STDOUT: !definition:
  301. // CHECK:STDOUT:
  302. // CHECK:STDOUT: fn(%self.param: @CC.as.Destroy.impl.Op.%ptr (%ptr.423)) = "no_op";
  303. // CHECK:STDOUT: }
  304. // CHECK:STDOUT:
  305. // CHECK:STDOUT: fn @F() {
  306. // CHECK:STDOUT: !entry:
  307. // CHECK:STDOUT: %CC.ref: %CC.type = name_ref CC, file.%CC.decl [concrete = constants.%CC.generic]
  308. // CHECK:STDOUT: %DD.ref: type = name_ref DD, file.%DD.decl [concrete = constants.%DD]
  309. // CHECK:STDOUT: %Y.facet: %Y.type = facet_value constants.%DD, (constants.%Y.impl_witness) [concrete = constants.%Y.facet.268]
  310. // CHECK:STDOUT: %.loc22_9: %Y.type = converted %DD.ref, %Y.facet [concrete = constants.%Y.facet.268]
  311. // CHECK:STDOUT: %CC: type = class_type @CC, @CC(constants.%Y.facet.268) [concrete = constants.%CC.7bf]
  312. // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
  313. // CHECK:STDOUT: %facet_value: %facet_type = facet_value constants.%DD, (constants.%Y.impl_witness, constants.%W.impl_witness) [concrete = constants.%facet_value]
  314. // CHECK:STDOUT: %.loc22_12.1: %facet_type = converted constants.%DD, %facet_value [concrete = constants.%facet_value]
  315. // CHECK:STDOUT: %Z.facet: %Z.type = facet_value constants.%CC.7bf, (constants.%Z.impl_witness.3b0) [concrete = constants.%Z.facet]
  316. // CHECK:STDOUT: %.loc22_12.2: %Z.type = converted %CC, %Z.facet [concrete = constants.%Z.facet]
  317. // CHECK:STDOUT: return
  318. // CHECK:STDOUT: }
  319. // CHECK:STDOUT:
  320. // CHECK:STDOUT: specific @CC(constants.%D) {
  321. // CHECK:STDOUT: %D.loc12_10.1 => constants.%D
  322. // CHECK:STDOUT: }
  323. // CHECK:STDOUT:
  324. // CHECK:STDOUT: specific @CC.as.Destroy.impl(constants.%D) {
  325. // CHECK:STDOUT: %D => constants.%D
  326. // CHECK:STDOUT: %CC => constants.%CC.3ba
  327. // CHECK:STDOUT: %Destroy.impl_witness => constants.%Destroy.impl_witness.a11
  328. // CHECK:STDOUT: }
  329. // CHECK:STDOUT:
  330. // CHECK:STDOUT: specific @CC.as.Destroy.impl.Op(constants.%D) {
  331. // CHECK:STDOUT: %D => constants.%D
  332. // CHECK:STDOUT: %CC => constants.%CC.3ba
  333. // CHECK:STDOUT: %ptr => constants.%ptr.423
  334. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.1ed
  335. // CHECK:STDOUT: }
  336. // CHECK:STDOUT:
  337. // CHECK:STDOUT: specific @CC(constants.%Y.facet.7ec) {
  338. // CHECK:STDOUT: %D.loc12_10.1 => constants.%Y.facet.7ec
  339. // CHECK:STDOUT: }
  340. // CHECK:STDOUT:
  341. // CHECK:STDOUT: specific @CC.as.Z.impl(constants.%E) {
  342. // CHECK:STDOUT: %E.loc19_14.2 => constants.%E
  343. // CHECK:STDOUT: %Y.lookup_impl_witness => constants.%Y.lookup_impl_witness
  344. // CHECK:STDOUT: %E.as_type.loc19_29.2 => constants.%E.as_type
  345. // CHECK:STDOUT: %Y.facet.loc19_29.2 => constants.%Y.facet.7ec
  346. // CHECK:STDOUT: %CC.loc19_29.2 => constants.%CC.d02
  347. // CHECK:STDOUT: %Z.impl_witness => constants.%Z.impl_witness.741
  348. // CHECK:STDOUT: }
  349. // CHECK:STDOUT:
  350. // CHECK:STDOUT: specific @CC(constants.%Y.facet.268) {
  351. // CHECK:STDOUT: %D.loc12_10.1 => constants.%Y.facet.268
  352. // CHECK:STDOUT: }
  353. // CHECK:STDOUT:
  354. // CHECK:STDOUT: specific @CC.as.Z.impl(constants.%facet_value) {
  355. // CHECK:STDOUT: %E.loc19_14.2 => constants.%facet_value
  356. // CHECK:STDOUT: %Y.lookup_impl_witness => constants.%Y.impl_witness
  357. // CHECK:STDOUT: %E.as_type.loc19_29.2 => constants.%DD
  358. // CHECK:STDOUT: %Y.facet.loc19_29.2 => constants.%Y.facet.268
  359. // CHECK:STDOUT: %CC.loc19_29.2 => constants.%CC.7bf
  360. // CHECK:STDOUT: %Z.impl_witness => constants.%Z.impl_witness.3b0
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: !definition:
  363. // CHECK:STDOUT: }
  364. // CHECK:STDOUT: