import_self_specific.carbon 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725
  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. // EXTRA-ARGS: --dump-sem-ir-ranges=ignore
  7. //
  8. // AUTOUPDATE
  9. // TIP: To test this file alone, run:
  10. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/import_self_specific.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/import_self_specific.carbon
  13. // --- impl_def.carbon
  14. library "[[@TEST_NAME]]";
  15. // The I.Assoc will be a facet of type Y.
  16. interface Y {}
  17. impl forall [T:! type] T as Y {}
  18. // C takes a facet of type Z.
  19. interface Z {}
  20. impl forall [U:! type] U as Z {}
  21. class C(V:! Z) {
  22. adapt ();
  23. }
  24. interface I {
  25. let Assoc:! Y;
  26. // This is a generic function with a specific that contains a reference `Self`
  27. // in it (in the ImplWitnessAccess for `Self.Assoc`). The `Self.Assoc` is
  28. // converted from `Y` to `Z`, so it holds a FacetValue in the specific with a
  29. // witness for impl lookup of `Self.Assoc as Z`. This `Self` gets imported
  30. // when an `impl` implements it, and should not be introduced into that
  31. // `impl`'s generic eval block.
  32. fn F(c: C(Assoc));
  33. }
  34. // --- impl_use.carbon
  35. library "[[@TEST_NAME]]";
  36. import library "impl_def";
  37. class E {}
  38. class D(N:! E) {}
  39. // The eval block for this generic `impl` must not include any instructions
  40. // derived from the import of `I.F`.
  41. //
  42. // This impl will import each entry in the interface `I`'s witness table. In
  43. // particular, that includes `F` and the specific containing `Self.Assoc as Z`.
  44. // When it does so, the eval block of `F` forms a new local eval block for the
  45. // imported generic. And when the generic is evaluated against a newly
  46. // constructed local self specific, any instructions created in the process of
  47. // that evaluation (such as inside impl lookup deduction against the U in the
  48. // impl for Z) should not be inappropriately added to this impl's generic eval
  49. // block.
  50. impl forall [N:! E] D(N) as I where .Assoc = () {
  51. fn F(unused c: C(())) {}
  52. }
  53. // CHECK:STDOUT: --- impl_def.carbon
  54. // CHECK:STDOUT:
  55. // CHECK:STDOUT: constants {
  56. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  57. // CHECK:STDOUT: %Self.162: %Y.type = symbolic_binding Self, 0 [symbolic]
  58. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  59. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  60. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  61. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  62. // CHECK:STDOUT: %Y.impl_witness: <witness> = impl_witness @T.as.Y.impl.%Y.impl_witness_table, @T.as.Y.impl(%T) [symbolic]
  63. // CHECK:STDOUT: %Y.facet: %Y.type = facet_value %T, (%Y.impl_witness) [symbolic]
  64. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  65. // CHECK:STDOUT: %Self.c59: %Z.type = symbolic_binding Self, 0 [symbolic]
  66. // CHECK:STDOUT: %U: type = symbolic_binding U, 0 [symbolic]
  67. // CHECK:STDOUT: %Z.impl_witness.856: <witness> = impl_witness @U.as.Z.impl.%Z.impl_witness_table, @U.as.Z.impl(%U) [symbolic]
  68. // CHECK:STDOUT: %Z.facet.f2d: %Z.type = facet_value %U, (%Z.impl_witness.856) [symbolic]
  69. // CHECK:STDOUT: %pattern_type.22b: type = pattern_type %Z.type [concrete]
  70. // CHECK:STDOUT: %V: %Z.type = symbolic_binding V, 0 [symbolic]
  71. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  72. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  73. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  74. // CHECK:STDOUT: %C.0ee: type = class_type @C, @C(%V) [symbolic]
  75. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  76. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_tuple.type [concrete]
  77. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  78. // CHECK:STDOUT: %Self.ab9: %I.type = symbolic_binding Self, 0 [symbolic]
  79. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  80. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%Assoc [concrete]
  81. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %Self.ab9, @I [symbolic]
  82. // CHECK:STDOUT: %impl.elem0: %Y.type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic]
  83. // CHECK:STDOUT: %as_type: type = facet_access_type %impl.elem0 [symbolic]
  84. // CHECK:STDOUT: %Z.lookup_impl_witness: <witness> = lookup_impl_witness %impl.elem0, @Z [symbolic]
  85. // CHECK:STDOUT: %Z.impl_witness.64d: <witness> = impl_witness @U.as.Z.impl.%Z.impl_witness_table, @U.as.Z.impl(%as_type) [symbolic]
  86. // CHECK:STDOUT: %.bf4: require_specific_def_type = require_specific_def @U.as.Z.impl(%as_type) [symbolic]
  87. // CHECK:STDOUT: %Z.facet.05b: %Z.type = facet_value %as_type, (%Z.lookup_impl_witness) [symbolic]
  88. // CHECK:STDOUT: %C.6ff: type = class_type @C, @C(%Z.facet.05b) [symbolic]
  89. // CHECK:STDOUT: %pattern_type.850: type = pattern_type %C.6ff [symbolic]
  90. // CHECK:STDOUT: %I.WithSelf.F.type: type = fn_type @I.WithSelf.F, @I.WithSelf(%Self.ab9) [symbolic]
  91. // CHECK:STDOUT: %I.WithSelf.F: %I.WithSelf.F.type = struct_value () [symbolic]
  92. // CHECK:STDOUT: %assoc1: %I.assoc_type = assoc_entity element1, @I.WithSelf.%I.WithSelf.F.decl [concrete]
  93. // CHECK:STDOUT: }
  94. // CHECK:STDOUT:
  95. // CHECK:STDOUT: file {
  96. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  97. // CHECK:STDOUT: .Y = %Y.decl
  98. // CHECK:STDOUT: .Z = %Z.decl
  99. // CHECK:STDOUT: .C = %C.decl
  100. // CHECK:STDOUT: .I = %I.decl
  101. // CHECK:STDOUT: }
  102. // CHECK:STDOUT: %Y.decl: type = interface_decl @Y [concrete = constants.%Y.type] {} {}
  103. // CHECK:STDOUT: impl_decl @T.as.Y.impl [concrete] {
  104. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  105. // CHECK:STDOUT: } {
  106. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc5_15.1 [symbolic = %T.loc5_15.2 (constants.%T)]
  107. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  108. // CHECK:STDOUT: %.loc5_18.1: type = splice_block %.loc5_18.2 [concrete = type] {
  109. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  110. // CHECK:STDOUT: %.loc5_18.2: type = type_literal type [concrete = type]
  111. // CHECK:STDOUT: }
  112. // CHECK:STDOUT: %T.loc5_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc5_15.2 (constants.%T)]
  113. // CHECK:STDOUT: }
  114. // CHECK:STDOUT: %Z.decl: type = interface_decl @Z [concrete = constants.%Z.type] {} {}
  115. // CHECK:STDOUT: impl_decl @U.as.Z.impl [concrete] {
  116. // CHECK:STDOUT: %U.patt: %pattern_type.98f = symbolic_binding_pattern U, 0 [concrete]
  117. // CHECK:STDOUT: } {
  118. // CHECK:STDOUT: %U.ref: type = name_ref U, %U.loc9_15.1 [symbolic = %U.loc9_15.2 (constants.%U)]
  119. // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
  120. // CHECK:STDOUT: %.loc9_18.1: type = splice_block %.loc9_18.2 [concrete = type] {
  121. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  122. // CHECK:STDOUT: %.loc9_18.2: type = type_literal type [concrete = type]
  123. // CHECK:STDOUT: }
  124. // CHECK:STDOUT: %U.loc9_15.1: type = symbolic_binding U, 0 [symbolic = %U.loc9_15.2 (constants.%U)]
  125. // CHECK:STDOUT: }
  126. // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] {
  127. // CHECK:STDOUT: %V.patt: %pattern_type.22b = symbolic_binding_pattern V, 0 [concrete]
  128. // CHECK:STDOUT: } {
  129. // CHECK:STDOUT: %.loc11: type = splice_block %Z.ref [concrete = constants.%Z.type] {
  130. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  131. // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
  132. // CHECK:STDOUT: }
  133. // CHECK:STDOUT: %V.loc11_10.2: %Z.type = symbolic_binding V, 0 [symbolic = %V.loc11_10.1 (constants.%V)]
  134. // CHECK:STDOUT: }
  135. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  136. // CHECK:STDOUT: }
  137. // CHECK:STDOUT:
  138. // CHECK:STDOUT: interface @Y {
  139. // CHECK:STDOUT: %Self: %Y.type = symbolic_binding Self, 0 [symbolic = constants.%Self.162]
  140. // CHECK:STDOUT: %Y.WithSelf.decl = interface_with_self_decl @Y [concrete]
  141. // CHECK:STDOUT:
  142. // CHECK:STDOUT: !members:
  143. // CHECK:STDOUT: .Self = %Self
  144. // CHECK:STDOUT: witness = ()
  145. // CHECK:STDOUT:
  146. // CHECK:STDOUT: !requires:
  147. // CHECK:STDOUT: }
  148. // CHECK:STDOUT:
  149. // CHECK:STDOUT: interface @Z {
  150. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.c59]
  151. // CHECK:STDOUT: %Z.WithSelf.decl = interface_with_self_decl @Z [concrete]
  152. // CHECK:STDOUT:
  153. // CHECK:STDOUT: !members:
  154. // CHECK:STDOUT: .Self = %Self
  155. // CHECK:STDOUT: witness = ()
  156. // CHECK:STDOUT:
  157. // CHECK:STDOUT: !requires:
  158. // CHECK:STDOUT: }
  159. // CHECK:STDOUT:
  160. // CHECK:STDOUT: interface @I {
  161. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self.ab9]
  162. // CHECK:STDOUT: %I.WithSelf.decl = interface_with_self_decl @I [concrete]
  163. // CHECK:STDOUT:
  164. // CHECK:STDOUT: !with Self:
  165. // CHECK:STDOUT: %Assoc: %Y.type = assoc_const_decl @Assoc [concrete] {
  166. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%Assoc [concrete = constants.%assoc0]
  167. // CHECK:STDOUT: }
  168. // CHECK:STDOUT: %I.WithSelf.F.decl: @I.WithSelf.%I.WithSelf.F.type (%I.WithSelf.F.type) = fn_decl @I.WithSelf.F [symbolic = @I.WithSelf.%I.WithSelf.F (constants.%I.WithSelf.F)] {
  169. // CHECK:STDOUT: %c.param_patt: @I.WithSelf.F.%pattern_type (%pattern_type.850) = value_param_pattern [concrete]
  170. // CHECK:STDOUT: %c.patt: @I.WithSelf.F.%pattern_type (%pattern_type.850) = at_binding_pattern c, %c.param_patt [concrete]
  171. // CHECK:STDOUT: } {
  172. // CHECK:STDOUT: %c.param: @I.WithSelf.F.%C.loc24_18.1 (%C.6ff) = value_param call_param0
  173. // CHECK:STDOUT: %.loc24_18.2: type = splice_block %C.loc24_18.2 [symbolic = %C.loc24_18.1 (constants.%C.6ff)] {
  174. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic]
  175. // CHECK:STDOUT: %impl.elem0.loc24_13.2: %Y.type = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc24_13.1 (constants.%impl.elem0)]
  176. // CHECK:STDOUT: %Assoc.ref: %Y.type = name_ref Assoc, %impl.elem0.loc24_13.2 [symbolic = %impl.elem0.loc24_13.1 (constants.%impl.elem0)]
  177. // CHECK:STDOUT: %Assoc.as_type: type = facet_access_type %Assoc.ref [symbolic = %as_type (constants.%as_type)]
  178. // CHECK:STDOUT: %Z.facet.loc24_18.2: %Z.type = facet_value %Assoc.as_type, (constants.%Z.lookup_impl_witness) [symbolic = %Z.facet.loc24_18.1 (constants.%Z.facet.05b)]
  179. // CHECK:STDOUT: %.loc24_18.3: %Z.type = converted %Assoc.ref, %Z.facet.loc24_18.2 [symbolic = %Z.facet.loc24_18.1 (constants.%Z.facet.05b)]
  180. // CHECK:STDOUT: %C.loc24_18.2: type = class_type @C, @C(constants.%Z.facet.05b) [symbolic = %C.loc24_18.1 (constants.%C.6ff)]
  181. // CHECK:STDOUT: }
  182. // CHECK:STDOUT: %c: @I.WithSelf.F.%C.loc24_18.1 (%C.6ff) = value_binding c, %c.param
  183. // CHECK:STDOUT: }
  184. // CHECK:STDOUT: %assoc1: %I.assoc_type = assoc_entity element1, %I.WithSelf.F.decl [concrete = constants.%assoc1]
  185. // CHECK:STDOUT:
  186. // CHECK:STDOUT: !members:
  187. // CHECK:STDOUT: .Self = %Self
  188. // CHECK:STDOUT: .Y = <poisoned>
  189. // CHECK:STDOUT: .C = <poisoned>
  190. // CHECK:STDOUT: .Y = <poisoned>
  191. // CHECK:STDOUT: .Assoc = @Assoc.%assoc0
  192. // CHECK:STDOUT: .C = <poisoned>
  193. // CHECK:STDOUT: .F = @I.WithSelf.%assoc1
  194. // CHECK:STDOUT: witness = (@I.WithSelf.%Assoc, @I.WithSelf.%I.WithSelf.F.decl)
  195. // CHECK:STDOUT:
  196. // CHECK:STDOUT: !requires:
  197. // CHECK:STDOUT: }
  198. // CHECK:STDOUT:
  199. // CHECK:STDOUT: generic impl @T.as.Y.impl(%T.loc5_15.1: type) {
  200. // CHECK:STDOUT: %T.loc5_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc5_15.2 (constants.%T)]
  201. // CHECK:STDOUT: %Y.impl_witness.loc5_31.2: <witness> = impl_witness %Y.impl_witness_table, @T.as.Y.impl(%T.loc5_15.2) [symbolic = %Y.impl_witness.loc5_31.2 (constants.%Y.impl_witness)]
  202. // CHECK:STDOUT:
  203. // CHECK:STDOUT: !definition:
  204. // CHECK:STDOUT:
  205. // CHECK:STDOUT: impl: %T.ref as %Y.ref {
  206. // CHECK:STDOUT: %Y.impl_witness_table = impl_witness_table (), @T.as.Y.impl [concrete]
  207. // CHECK:STDOUT: %Y.impl_witness.loc5_31.1: <witness> = impl_witness %Y.impl_witness_table, @T.as.Y.impl(constants.%T) [symbolic = %Y.impl_witness.loc5_31.2 (constants.%Y.impl_witness)]
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: !members:
  210. // CHECK:STDOUT: witness = %Y.impl_witness.loc5_31.1
  211. // CHECK:STDOUT: }
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: generic impl @U.as.Z.impl(%U.loc9_15.1: type) {
  215. // CHECK:STDOUT: %U.loc9_15.2: type = symbolic_binding U, 0 [symbolic = %U.loc9_15.2 (constants.%U)]
  216. // CHECK:STDOUT: %Z.impl_witness.loc9_31.2: <witness> = impl_witness %Z.impl_witness_table, @U.as.Z.impl(%U.loc9_15.2) [symbolic = %Z.impl_witness.loc9_31.2 (constants.%Z.impl_witness.856)]
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: !definition:
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: impl: %U.ref as %Z.ref {
  221. // CHECK:STDOUT: %Z.impl_witness_table = impl_witness_table (), @U.as.Z.impl [concrete]
  222. // CHECK:STDOUT: %Z.impl_witness.loc9_31.1: <witness> = impl_witness %Z.impl_witness_table, @U.as.Z.impl(constants.%U) [symbolic = %Z.impl_witness.loc9_31.2 (constants.%Z.impl_witness.856)]
  223. // CHECK:STDOUT:
  224. // CHECK:STDOUT: !members:
  225. // CHECK:STDOUT: witness = %Z.impl_witness.loc9_31.1
  226. // CHECK:STDOUT: }
  227. // CHECK:STDOUT: }
  228. // CHECK:STDOUT:
  229. // CHECK:STDOUT: generic class @C(%V.loc11_10.2: %Z.type) {
  230. // CHECK:STDOUT: %V.loc11_10.1: %Z.type = symbolic_binding V, 0 [symbolic = %V.loc11_10.1 (constants.%V)]
  231. // CHECK:STDOUT:
  232. // CHECK:STDOUT: !definition:
  233. // CHECK:STDOUT:
  234. // CHECK:STDOUT: class {
  235. // CHECK:STDOUT: %.loc12_10: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  236. // CHECK:STDOUT: %.loc12_11: type = converted %.loc12_10, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  237. // CHECK:STDOUT: adapt_decl %.loc12_11 [concrete]
  238. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_tuple.type [concrete = constants.%complete_type]
  239. // CHECK:STDOUT: complete_type_witness = %complete_type
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: !members:
  242. // CHECK:STDOUT: .Self = constants.%C.0ee
  243. // CHECK:STDOUT: }
  244. // CHECK:STDOUT: }
  245. // CHECK:STDOUT:
  246. // CHECK:STDOUT: generic fn @I.WithSelf.F(@I.%Self: %I.type) {
  247. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.ab9)]
  248. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %Self, @I [symbolic = %I.lookup_impl_witness (constants.%I.lookup_impl_witness)]
  249. // CHECK:STDOUT: %impl.elem0.loc24_13.1: %Y.type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc24_13.1 (constants.%impl.elem0)]
  250. // CHECK:STDOUT: %as_type: type = facet_access_type %impl.elem0.loc24_13.1 [symbolic = %as_type (constants.%as_type)]
  251. // CHECK:STDOUT: %.loc24_18.1: require_specific_def_type = require_specific_def @U.as.Z.impl(%as_type) [symbolic = %.loc24_18.1 (constants.%.bf4)]
  252. // CHECK:STDOUT: %Z.lookup_impl_witness: <witness> = lookup_impl_witness %impl.elem0.loc24_13.1, @Z [symbolic = %Z.lookup_impl_witness (constants.%Z.lookup_impl_witness)]
  253. // CHECK:STDOUT: %Z.facet.loc24_18.1: %Z.type = facet_value %as_type, (%Z.lookup_impl_witness) [symbolic = %Z.facet.loc24_18.1 (constants.%Z.facet.05b)]
  254. // CHECK:STDOUT: %C.loc24_18.1: type = class_type @C, @C(%Z.facet.loc24_18.1) [symbolic = %C.loc24_18.1 (constants.%C.6ff)]
  255. // CHECK:STDOUT: %pattern_type: type = pattern_type %C.loc24_18.1 [symbolic = %pattern_type (constants.%pattern_type.850)]
  256. // CHECK:STDOUT:
  257. // CHECK:STDOUT: fn(%c.param: @I.WithSelf.F.%C.loc24_18.1 (%C.6ff));
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT:
  260. // CHECK:STDOUT: specific @Y.WithSelf(constants.%Self.162) {
  261. // CHECK:STDOUT: !definition:
  262. // CHECK:STDOUT: }
  263. // CHECK:STDOUT:
  264. // CHECK:STDOUT: specific @T.as.Y.impl(constants.%T) {
  265. // CHECK:STDOUT: %T.loc5_15.2 => constants.%T
  266. // CHECK:STDOUT: %Y.impl_witness.loc5_31.2 => constants.%Y.impl_witness
  267. // CHECK:STDOUT: }
  268. // CHECK:STDOUT:
  269. // CHECK:STDOUT: specific @Y.WithSelf(constants.%Y.facet) {
  270. // CHECK:STDOUT: !definition:
  271. // CHECK:STDOUT: }
  272. // CHECK:STDOUT:
  273. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.c59) {
  274. // CHECK:STDOUT: !definition:
  275. // CHECK:STDOUT: }
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: specific @U.as.Z.impl(constants.%U) {
  278. // CHECK:STDOUT: %U.loc9_15.2 => constants.%U
  279. // CHECK:STDOUT: %Z.impl_witness.loc9_31.2 => constants.%Z.impl_witness.856
  280. // CHECK:STDOUT: }
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Z.facet.f2d) {
  283. // CHECK:STDOUT: !definition:
  284. // CHECK:STDOUT: }
  285. // CHECK:STDOUT:
  286. // CHECK:STDOUT: specific @C(constants.%V) {
  287. // CHECK:STDOUT: %V.loc11_10.1 => constants.%V
  288. // CHECK:STDOUT: }
  289. // CHECK:STDOUT:
  290. // CHECK:STDOUT: specific @I.WithSelf(constants.%Self.ab9) {}
  291. // CHECK:STDOUT:
  292. // CHECK:STDOUT: specific @U.as.Z.impl(constants.%as_type) {
  293. // CHECK:STDOUT: %U.loc9_15.2 => constants.%as_type
  294. // CHECK:STDOUT: %Z.impl_witness.loc9_31.2 => constants.%Z.impl_witness.64d
  295. // CHECK:STDOUT:
  296. // CHECK:STDOUT: !definition:
  297. // CHECK:STDOUT: }
  298. // CHECK:STDOUT:
  299. // CHECK:STDOUT: specific @C(constants.%Z.facet.05b) {
  300. // CHECK:STDOUT: %V.loc11_10.1 => constants.%Z.facet.05b
  301. // CHECK:STDOUT: }
  302. // CHECK:STDOUT:
  303. // CHECK:STDOUT: specific @I.WithSelf.F(constants.%Self.ab9) {
  304. // CHECK:STDOUT: %Self => constants.%Self.ab9
  305. // CHECK:STDOUT: %I.lookup_impl_witness => constants.%I.lookup_impl_witness
  306. // CHECK:STDOUT: %impl.elem0.loc24_13.1 => constants.%impl.elem0
  307. // CHECK:STDOUT: %as_type => constants.%as_type
  308. // CHECK:STDOUT: %.loc24_18.1 => constants.%.bf4
  309. // CHECK:STDOUT: %Z.lookup_impl_witness => constants.%Z.lookup_impl_witness
  310. // CHECK:STDOUT: %Z.facet.loc24_18.1 => constants.%Z.facet.05b
  311. // CHECK:STDOUT: %C.loc24_18.1 => constants.%C.6ff
  312. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.850
  313. // CHECK:STDOUT: }
  314. // CHECK:STDOUT:
  315. // CHECK:STDOUT: --- impl_use.carbon
  316. // CHECK:STDOUT:
  317. // CHECK:STDOUT: constants {
  318. // CHECK:STDOUT: %E: type = class_type @E [concrete]
  319. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  320. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  321. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  322. // CHECK:STDOUT: %.Self.c39: %type = symbolic_binding .Self [symbolic_self]
  323. // CHECK:STDOUT: %pattern_type.99f: type = pattern_type %E [concrete]
  324. // CHECK:STDOUT: %N: %E = symbolic_binding N, 0 [symbolic]
  325. // CHECK:STDOUT: %D.type: type = generic_class_type @D [concrete]
  326. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  327. // CHECK:STDOUT: %D.generic: %D.type = struct_value () [concrete]
  328. // CHECK:STDOUT: %D: type = class_type @D, @D(%N) [symbolic]
  329. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  330. // CHECK:STDOUT: %Self.651: %I.type = symbolic_binding Self, 0 [symbolic]
  331. // CHECK:STDOUT: %I.WithSelf.F.type.a1f: type = fn_type @I.WithSelf.F, @I.WithSelf(%Self.651) [symbolic]
  332. // CHECK:STDOUT: %I.WithSelf.F.cc3: %I.WithSelf.F.type.a1f = struct_value () [symbolic]
  333. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  334. // CHECK:STDOUT: %Self.ea3: %Z.type = symbolic_binding Self, 0 [symbolic]
  335. // CHECK:STDOUT: %I.lookup_impl_witness.99c: <witness> = lookup_impl_witness %Self.651, @I [symbolic]
  336. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  337. // CHECK:STDOUT: %Self.d4d: %Y.type = symbolic_binding Self, 0 [symbolic]
  338. // CHECK:STDOUT: %impl.elem0.37f: %Y.type = impl_witness_access %I.lookup_impl_witness.99c, element0 [symbolic]
  339. // CHECK:STDOUT: %Z.lookup_impl_witness: <witness> = lookup_impl_witness %impl.elem0.37f, @Z [symbolic]
  340. // CHECK:STDOUT: %as_type: type = facet_access_type %impl.elem0.37f [symbolic]
  341. // CHECK:STDOUT: %Z.facet.fd6: %Z.type = facet_value %as_type, (%Z.lookup_impl_witness) [symbolic]
  342. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  343. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  344. // CHECK:STDOUT: %complete_type.782: <witness> = complete_type_witness %empty_tuple.type [concrete]
  345. // CHECK:STDOUT: %V: %Z.type = symbolic_binding V, 0 [symbolic]
  346. // CHECK:STDOUT: %C.ffe: type = class_type @C, @C(%Z.facet.fd6) [symbolic]
  347. // CHECK:STDOUT: %pattern_type.be3: type = pattern_type %C.ffe [symbolic]
  348. // CHECK:STDOUT: %U: type = symbolic_binding U, 0 [symbolic]
  349. // CHECK:STDOUT: %Z.impl_witness.856: <witness> = impl_witness imports.%Z.impl_witness_table, @U.as.Z.impl(%U) [symbolic]
  350. // CHECK:STDOUT: %.3cb: require_specific_def_type = require_specific_def @U.as.Z.impl(%as_type) [symbolic]
  351. // CHECK:STDOUT: %Z.impl_witness.907: <witness> = impl_witness imports.%Z.impl_witness_table, @U.as.Z.impl(%as_type) [symbolic]
  352. // CHECK:STDOUT: %.Self.1dc: %I.type = symbolic_binding .Self [symbolic_self]
  353. // CHECK:STDOUT: %I.WithSelf.F.type.29d: type = fn_type @I.WithSelf.F, @I.WithSelf(%.Self.1dc) [symbolic_self]
  354. // CHECK:STDOUT: %I.WithSelf.F.8ec: %I.WithSelf.F.type.29d = struct_value () [symbolic_self]
  355. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.1dc [symbolic_self]
  356. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  357. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.c8f [concrete]
  358. // CHECK:STDOUT: %I.lookup_impl_witness.c4b: <witness> = lookup_impl_witness %.Self.1dc, @I [symbolic_self]
  359. // CHECK:STDOUT: %impl.elem0.66e: %Y.type = impl_witness_access %I.lookup_impl_witness.c4b, element0 [symbolic_self]
  360. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  361. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  362. // CHECK:STDOUT: %Y.impl_witness.d43: <witness> = impl_witness imports.%Y.impl_witness_table, @T.as.Y.impl(%T) [symbolic]
  363. // CHECK:STDOUT: %Y.impl_witness.980: <witness> = impl_witness imports.%Y.impl_witness_table, @T.as.Y.impl(%empty_tuple.type) [concrete]
  364. // CHECK:STDOUT: %Y.facet: %Y.type = facet_value %empty_tuple.type, (%Y.impl_witness.980) [concrete]
  365. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0.66e = %Y.facet> [concrete]
  366. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness @D.as.I.impl.%I.impl_witness_table, @D.as.I.impl(%N) [symbolic]
  367. // CHECK:STDOUT: %Z.impl_witness.db1: <witness> = impl_witness imports.%Z.impl_witness_table, @U.as.Z.impl(%empty_tuple.type) [concrete]
  368. // CHECK:STDOUT: %.194: require_specific_def_type = require_specific_def @U.as.Z.impl(%empty_tuple.type) [concrete]
  369. // CHECK:STDOUT: %Z.facet.8bd: %Z.type = facet_value %empty_tuple.type, (%Z.impl_witness.db1) [concrete]
  370. // CHECK:STDOUT: %C.a44: type = class_type @C, @C(%Z.facet.8bd) [concrete]
  371. // CHECK:STDOUT: %pattern_type.479: type = pattern_type %C.a44 [concrete]
  372. // CHECK:STDOUT: %D.as.I.impl.F.type: type = fn_type @D.as.I.impl.F, @D.as.I.impl(%N) [symbolic]
  373. // CHECK:STDOUT: %D.as.I.impl.F: %D.as.I.impl.F.type = struct_value () [symbolic]
  374. // CHECK:STDOUT: %I.facet: %I.type = facet_value %D, (%I.impl_witness) [symbolic]
  375. // CHECK:STDOUT: %I.WithSelf.F.type.a33: type = fn_type @I.WithSelf.F, @I.WithSelf(%I.facet) [symbolic]
  376. // CHECK:STDOUT: %I.WithSelf.F.b0f: %I.WithSelf.F.type.a33 = struct_value () [symbolic]
  377. // CHECK:STDOUT: }
  378. // CHECK:STDOUT:
  379. // CHECK:STDOUT: imports {
  380. // CHECK:STDOUT: %Main.Y = import_ref Main//impl_def, Y, unloaded
  381. // CHECK:STDOUT: %Main.Z = import_ref Main//impl_def, Z, unloaded
  382. // CHECK:STDOUT: %Main.C: %C.type = import_ref Main//impl_def, C, loaded [concrete = constants.%C.generic]
  383. // CHECK:STDOUT: %Main.I: type = import_ref Main//impl_def, I, loaded [concrete = constants.%I.type]
  384. // CHECK:STDOUT: %Main.import_ref.414: %I.assoc_type = import_ref Main//impl_def, loc16_12, loaded [concrete = constants.%assoc0]
  385. // CHECK:STDOUT: %Main.import_ref.d7f = import_ref Main//impl_def, loc24_20, unloaded
  386. // CHECK:STDOUT: %Main.Assoc: %Y.type = import_ref Main//impl_def, Assoc, loaded [concrete = %Assoc]
  387. // CHECK:STDOUT: %Main.F: @I.WithSelf.%I.WithSelf.F.type (%I.WithSelf.F.type.a1f) = import_ref Main//impl_def, F, loaded [symbolic = @I.WithSelf.%I.WithSelf.F (constants.%I.WithSelf.F.cc3)]
  388. // CHECK:STDOUT: %Main.import_ref.69e = import_ref Main//impl_def, loc8_13, unloaded
  389. // CHECK:STDOUT: %Main.import_ref.3e2 = import_ref Main//impl_def, loc4_13, unloaded
  390. // CHECK:STDOUT: %Main.import_ref.3fc: <witness> = import_ref Main//impl_def, loc13_1, loaded [concrete = constants.%complete_type.782]
  391. // CHECK:STDOUT: %Main.import_ref.70d = import_ref Main//impl_def, inst{{[0-9A-F]+}} [no loc], unloaded
  392. // CHECK:STDOUT: %Main.import_ref.aa4: %Z.type = import_ref Main//impl_def, loc11_10, loaded [symbolic = @C.%V (constants.%V)]
  393. // CHECK:STDOUT: %Main.import_ref.910: <witness> = import_ref Main//impl_def, loc9_31, loaded [symbolic = @U.as.Z.impl.%Z.impl_witness (constants.%Z.impl_witness.856)]
  394. // CHECK:STDOUT: %Z.impl_witness_table = impl_witness_table (), @U.as.Z.impl [concrete]
  395. // CHECK:STDOUT: %Main.import_ref.b7a: type = import_ref Main//impl_def, loc9_24, loaded [symbolic = @U.as.Z.impl.%U (constants.%U)]
  396. // CHECK:STDOUT: %Main.import_ref.926: type = import_ref Main//impl_def, loc9_29, loaded [concrete = constants.%Z.type]
  397. // CHECK:STDOUT: %Main.import_ref.b3bc94.1: type = import_ref Main//impl_def, loc9_15, loaded [symbolic = @U.as.Z.impl.%U (constants.%U)]
  398. // CHECK:STDOUT: %Main.import_ref.2362f8.2: %I.type = import_ref Main//impl_def, loc15_13, loaded [symbolic = constants.%Self.651]
  399. // CHECK:STDOUT: %Main.import_ref.c82 = import_ref Main//impl_def, loc15_13, unloaded
  400. // CHECK:STDOUT: %Main.import_ref.c8f: %Y.type = import_ref Main//impl_def, loc16_12, loaded [concrete = %Assoc]
  401. // CHECK:STDOUT: %Assoc: %Y.type = assoc_const_decl @Assoc [concrete] {}
  402. // CHECK:STDOUT: %Main.import_ref.d1e: <witness> = import_ref Main//impl_def, loc5_31, loaded [symbolic = @T.as.Y.impl.%Y.impl_witness (constants.%Y.impl_witness.d43)]
  403. // CHECK:STDOUT: %Y.impl_witness_table = impl_witness_table (), @T.as.Y.impl [concrete]
  404. // CHECK:STDOUT: %Main.import_ref.68d: type = import_ref Main//impl_def, loc5_24, loaded [symbolic = @T.as.Y.impl.%T (constants.%T)]
  405. // CHECK:STDOUT: %Main.import_ref.87e: type = import_ref Main//impl_def, loc5_29, loaded [concrete = constants.%Y.type]
  406. // CHECK:STDOUT: %Main.import_ref.b3bc94.2: type = import_ref Main//impl_def, loc5_15, loaded [symbolic = @T.as.Y.impl.%T (constants.%T)]
  407. // CHECK:STDOUT: }
  408. // CHECK:STDOUT:
  409. // CHECK:STDOUT: file {
  410. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  411. // CHECK:STDOUT: .Y = imports.%Main.Y
  412. // CHECK:STDOUT: .Z = imports.%Main.Z
  413. // CHECK:STDOUT: .C = imports.%Main.C
  414. // CHECK:STDOUT: .I = imports.%Main.I
  415. // CHECK:STDOUT: .E = %E.decl
  416. // CHECK:STDOUT: .D = %D.decl
  417. // CHECK:STDOUT: }
  418. // CHECK:STDOUT: %default.import = import <none>
  419. // CHECK:STDOUT: %E.decl: type = class_decl @E [concrete = constants.%E] {} {}
  420. // CHECK:STDOUT: %D.decl: %D.type = class_decl @D [concrete = constants.%D.generic] {
  421. // CHECK:STDOUT: %N.patt: %pattern_type.99f = symbolic_binding_pattern N, 0 [concrete]
  422. // CHECK:STDOUT: } {
  423. // CHECK:STDOUT: %.loc7: type = splice_block %E.ref [concrete = constants.%E] {
  424. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.c39]
  425. // CHECK:STDOUT: %E.ref: type = name_ref E, file.%E.decl [concrete = constants.%E]
  426. // CHECK:STDOUT: }
  427. // CHECK:STDOUT: %N.loc7_10.2: %E = symbolic_binding N, 0 [symbolic = %N.loc7_10.1 (constants.%N)]
  428. // CHECK:STDOUT: }
  429. // CHECK:STDOUT: impl_decl @D.as.I.impl [concrete] {
  430. // CHECK:STDOUT: %N.patt: %pattern_type.99f = symbolic_binding_pattern N, 0 [concrete]
  431. // CHECK:STDOUT: } {
  432. // CHECK:STDOUT: %D.ref: %D.type = name_ref D, file.%D.decl [concrete = constants.%D.generic]
  433. // CHECK:STDOUT: %N.ref: %E = name_ref N, %N.loc20_15.2 [symbolic = %N.loc20_15.1 (constants.%N)]
  434. // CHECK:STDOUT: %D.loc20_24.2: type = class_type @D, @D(constants.%N) [symbolic = %D.loc20_24.1 (constants.%D)]
  435. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  436. // CHECK:STDOUT: %.Self.1: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.1dc]
  437. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self.1 [symbolic_self = constants.%.Self.1dc]
  438. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  439. // CHECK:STDOUT: %.loc20_37: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  440. // CHECK:STDOUT: %Assoc.ref: %I.assoc_type = name_ref Assoc, imports.%Main.import_ref.414 [concrete = constants.%assoc0]
  441. // CHECK:STDOUT: %impl.elem0: %Y.type = impl_witness_access constants.%I.lookup_impl_witness.c4b, element0 [symbolic_self = constants.%impl.elem0.66e]
  442. // CHECK:STDOUT: %.loc20_47.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  443. // CHECK:STDOUT: %Y.facet: %Y.type = facet_value constants.%empty_tuple.type, (constants.%Y.impl_witness.980) [concrete = constants.%Y.facet]
  444. // CHECK:STDOUT: %.loc20_47.2: %Y.type = converted %.loc20_47.1, %Y.facet [concrete = constants.%Y.facet]
  445. // CHECK:STDOUT: %.loc20_31: type = where_expr %.Self.1 [concrete = constants.%I_where.type] {
  446. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  447. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc20_47.2
  448. // CHECK:STDOUT: }
  449. // CHECK:STDOUT: %.loc20_18: type = splice_block %E.ref [concrete = constants.%E] {
  450. // CHECK:STDOUT: %.Self.2: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.c39]
  451. // CHECK:STDOUT: %E.ref: type = name_ref E, file.%E.decl [concrete = constants.%E]
  452. // CHECK:STDOUT: }
  453. // CHECK:STDOUT: %N.loc20_15.2: %E = symbolic_binding N, 0 [symbolic = %N.loc20_15.1 (constants.%N)]
  454. // CHECK:STDOUT: }
  455. // CHECK:STDOUT: }
  456. // CHECK:STDOUT:
  457. // CHECK:STDOUT: interface @I [from "impl_def.carbon"] {
  458. // CHECK:STDOUT: !members:
  459. // CHECK:STDOUT: .Self = imports.%Main.import_ref.c82
  460. // CHECK:STDOUT: .Assoc = imports.%Main.import_ref.414
  461. // CHECK:STDOUT: .F = imports.%Main.import_ref.d7f
  462. // CHECK:STDOUT: witness = (imports.%Main.Assoc, imports.%Main.F)
  463. // CHECK:STDOUT:
  464. // CHECK:STDOUT: !requires:
  465. // CHECK:STDOUT: }
  466. // CHECK:STDOUT:
  467. // CHECK:STDOUT: interface @Z [from "impl_def.carbon"] {
  468. // CHECK:STDOUT: !members:
  469. // CHECK:STDOUT: .Self = imports.%Main.import_ref.69e
  470. // CHECK:STDOUT: witness = ()
  471. // CHECK:STDOUT:
  472. // CHECK:STDOUT: !requires:
  473. // CHECK:STDOUT: }
  474. // CHECK:STDOUT:
  475. // CHECK:STDOUT: interface @Y [from "impl_def.carbon"] {
  476. // CHECK:STDOUT: !members:
  477. // CHECK:STDOUT: .Self = imports.%Main.import_ref.3e2
  478. // CHECK:STDOUT: witness = ()
  479. // CHECK:STDOUT:
  480. // CHECK:STDOUT: !requires:
  481. // CHECK:STDOUT: }
  482. // CHECK:STDOUT:
  483. // CHECK:STDOUT: generic impl @U.as.Z.impl(imports.%Main.import_ref.b3bc94.1: type) [from "impl_def.carbon"] {
  484. // CHECK:STDOUT: %U: type = symbolic_binding U, 0 [symbolic = %U (constants.%U)]
  485. // CHECK:STDOUT: %Z.impl_witness: <witness> = impl_witness imports.%Z.impl_witness_table, @U.as.Z.impl(%U) [symbolic = %Z.impl_witness (constants.%Z.impl_witness.856)]
  486. // CHECK:STDOUT:
  487. // CHECK:STDOUT: !definition:
  488. // CHECK:STDOUT:
  489. // CHECK:STDOUT: impl: imports.%Main.import_ref.b7a as imports.%Main.import_ref.926 {
  490. // CHECK:STDOUT: !members:
  491. // CHECK:STDOUT: witness = imports.%Main.import_ref.910
  492. // CHECK:STDOUT: }
  493. // CHECK:STDOUT: }
  494. // CHECK:STDOUT:
  495. // CHECK:STDOUT: generic impl @T.as.Y.impl(imports.%Main.import_ref.b3bc94.2: type) [from "impl_def.carbon"] {
  496. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)]
  497. // CHECK:STDOUT: %Y.impl_witness: <witness> = impl_witness imports.%Y.impl_witness_table, @T.as.Y.impl(%T) [symbolic = %Y.impl_witness (constants.%Y.impl_witness.d43)]
  498. // CHECK:STDOUT:
  499. // CHECK:STDOUT: !definition:
  500. // CHECK:STDOUT:
  501. // CHECK:STDOUT: impl: imports.%Main.import_ref.68d as imports.%Main.import_ref.87e {
  502. // CHECK:STDOUT: !members:
  503. // CHECK:STDOUT: witness = imports.%Main.import_ref.d1e
  504. // CHECK:STDOUT: }
  505. // CHECK:STDOUT: }
  506. // CHECK:STDOUT:
  507. // CHECK:STDOUT: generic impl @D.as.I.impl(%N.loc20_15.2: %E) {
  508. // CHECK:STDOUT: %N.loc20_15.1: %E = symbolic_binding N, 0 [symbolic = %N.loc20_15.1 (constants.%N)]
  509. // CHECK:STDOUT: %D.loc20_24.1: type = class_type @D, @D(%N.loc20_15.1) [symbolic = %D.loc20_24.1 (constants.%D)]
  510. // CHECK:STDOUT: %I.impl_witness.loc20_49.2: <witness> = impl_witness %I.impl_witness_table, @D.as.I.impl(%N.loc20_15.1) [symbolic = %I.impl_witness.loc20_49.2 (constants.%I.impl_witness)]
  511. // CHECK:STDOUT:
  512. // CHECK:STDOUT: !definition:
  513. // CHECK:STDOUT: %D.as.I.impl.F.type: type = fn_type @D.as.I.impl.F, @D.as.I.impl(%N.loc20_15.1) [symbolic = %D.as.I.impl.F.type (constants.%D.as.I.impl.F.type)]
  514. // CHECK:STDOUT: %D.as.I.impl.F: @D.as.I.impl.%D.as.I.impl.F.type (%D.as.I.impl.F.type) = struct_value () [symbolic = %D.as.I.impl.F (constants.%D.as.I.impl.F)]
  515. // CHECK:STDOUT:
  516. // CHECK:STDOUT: impl: %D.loc20_24.2 as %.loc20_31 {
  517. // CHECK:STDOUT: %D.as.I.impl.F.decl: @D.as.I.impl.%D.as.I.impl.F.type (%D.as.I.impl.F.type) = fn_decl @D.as.I.impl.F [symbolic = @D.as.I.impl.%D.as.I.impl.F (constants.%D.as.I.impl.F)] {
  518. // CHECK:STDOUT: %c.param_patt: %pattern_type.479 = value_param_pattern [concrete]
  519. // CHECK:STDOUT: %c.patt: %pattern_type.479 = at_binding_pattern c, %c.param_patt [concrete]
  520. // CHECK:STDOUT: } {
  521. // CHECK:STDOUT: %c.param: %C.a44 = value_param call_param0
  522. // CHECK:STDOUT: %.loc21_22.1: type = splice_block %C [concrete = constants.%C.a44] {
  523. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Main.C [concrete = constants.%C.generic]
  524. // CHECK:STDOUT: %.loc21_21: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  525. // CHECK:STDOUT: %Z.facet: %Z.type = facet_value constants.%empty_tuple.type, (constants.%Z.impl_witness.db1) [concrete = constants.%Z.facet.8bd]
  526. // CHECK:STDOUT: %.loc21_22.2: %Z.type = converted %.loc21_21, %Z.facet [concrete = constants.%Z.facet.8bd]
  527. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%Z.facet.8bd) [concrete = constants.%C.a44]
  528. // CHECK:STDOUT: }
  529. // CHECK:STDOUT: %c: %C.a44 = value_binding c, %c.param
  530. // CHECK:STDOUT: }
  531. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant, %D.as.I.impl.F.decl), @D.as.I.impl [concrete]
  532. // CHECK:STDOUT: %I.impl_witness.loc20_49.1: <witness> = impl_witness %I.impl_witness_table, @D.as.I.impl(constants.%N) [symbolic = %I.impl_witness.loc20_49.2 (constants.%I.impl_witness)]
  533. // CHECK:STDOUT: %impl_witness_assoc_constant: %Y.type = impl_witness_assoc_constant constants.%Y.facet [concrete = constants.%Y.facet]
  534. // CHECK:STDOUT:
  535. // CHECK:STDOUT: !members:
  536. // CHECK:STDOUT: .C = <poisoned>
  537. // CHECK:STDOUT: .F = %D.as.I.impl.F.decl
  538. // CHECK:STDOUT: witness = %I.impl_witness.loc20_49.1
  539. // CHECK:STDOUT: }
  540. // CHECK:STDOUT: }
  541. // CHECK:STDOUT:
  542. // CHECK:STDOUT: class @E {
  543. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357]
  544. // CHECK:STDOUT: complete_type_witness = %complete_type
  545. // CHECK:STDOUT:
  546. // CHECK:STDOUT: !members:
  547. // CHECK:STDOUT: .Self = constants.%E
  548. // CHECK:STDOUT: }
  549. // CHECK:STDOUT:
  550. // CHECK:STDOUT: generic class @D(%N.loc7_10.2: %E) {
  551. // CHECK:STDOUT: %N.loc7_10.1: %E = symbolic_binding N, 0 [symbolic = %N.loc7_10.1 (constants.%N)]
  552. // CHECK:STDOUT:
  553. // CHECK:STDOUT: !definition:
  554. // CHECK:STDOUT:
  555. // CHECK:STDOUT: class {
  556. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357]
  557. // CHECK:STDOUT: complete_type_witness = %complete_type
  558. // CHECK:STDOUT:
  559. // CHECK:STDOUT: !members:
  560. // CHECK:STDOUT: .Self = constants.%D
  561. // CHECK:STDOUT: }
  562. // CHECK:STDOUT: }
  563. // CHECK:STDOUT:
  564. // CHECK:STDOUT: generic class @C(imports.%Main.import_ref.aa4: %Z.type) [from "impl_def.carbon"] {
  565. // CHECK:STDOUT: %V: %Z.type = symbolic_binding V, 0 [symbolic = %V (constants.%V)]
  566. // CHECK:STDOUT:
  567. // CHECK:STDOUT: !definition:
  568. // CHECK:STDOUT:
  569. // CHECK:STDOUT: class {
  570. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.3fc
  571. // CHECK:STDOUT:
  572. // CHECK:STDOUT: !members:
  573. // CHECK:STDOUT: .Self = imports.%Main.import_ref.70d
  574. // CHECK:STDOUT: }
  575. // CHECK:STDOUT: }
  576. // CHECK:STDOUT:
  577. // CHECK:STDOUT: generic fn @I.WithSelf.F(imports.%Main.import_ref.2362f8.2: %I.type) [from "impl_def.carbon"] {
  578. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.651)]
  579. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %Self, @I [symbolic = %I.lookup_impl_witness (constants.%I.lookup_impl_witness.99c)]
  580. // CHECK:STDOUT: %impl.elem0: %Y.type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic = %impl.elem0 (constants.%impl.elem0.37f)]
  581. // CHECK:STDOUT: %as_type: type = facet_access_type %impl.elem0 [symbolic = %as_type (constants.%as_type)]
  582. // CHECK:STDOUT: %.1: require_specific_def_type = require_specific_def @U.as.Z.impl(%as_type) [symbolic = %.1 (constants.%.3cb)]
  583. // CHECK:STDOUT: %Z.lookup_impl_witness: <witness> = lookup_impl_witness %impl.elem0, @Z [symbolic = %Z.lookup_impl_witness (constants.%Z.lookup_impl_witness)]
  584. // CHECK:STDOUT: %Z.facet: %Z.type = facet_value %as_type, (%Z.lookup_impl_witness) [symbolic = %Z.facet (constants.%Z.facet.fd6)]
  585. // CHECK:STDOUT: %C: type = class_type @C, @C(%Z.facet) [symbolic = %C (constants.%C.ffe)]
  586. // CHECK:STDOUT: %pattern_type: type = pattern_type %C [symbolic = %pattern_type (constants.%pattern_type.be3)]
  587. // CHECK:STDOUT:
  588. // CHECK:STDOUT: fn;
  589. // CHECK:STDOUT: }
  590. // CHECK:STDOUT:
  591. // CHECK:STDOUT: generic fn @D.as.I.impl.F(@D.as.I.impl.%N.loc20_15.2: %E) {
  592. // CHECK:STDOUT: !definition:
  593. // CHECK:STDOUT:
  594. // CHECK:STDOUT: fn(%c.param: %C.a44) {
  595. // CHECK:STDOUT: !entry:
  596. // CHECK:STDOUT: return
  597. // CHECK:STDOUT: }
  598. // CHECK:STDOUT: }
  599. // CHECK:STDOUT:
  600. // CHECK:STDOUT: specific @D(constants.%N) {
  601. // CHECK:STDOUT: %N.loc7_10.1 => constants.%N
  602. // CHECK:STDOUT: }
  603. // CHECK:STDOUT:
  604. // CHECK:STDOUT: specific @I.WithSelf(constants.%Self.651) {
  605. // CHECK:STDOUT: !definition:
  606. // CHECK:STDOUT: %Self => constants.%Self.651
  607. // CHECK:STDOUT: %I.WithSelf.F.type => constants.%I.WithSelf.F.type.a1f
  608. // CHECK:STDOUT: %I.WithSelf.F => constants.%I.WithSelf.F.cc3
  609. // CHECK:STDOUT: }
  610. // CHECK:STDOUT:
  611. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.ea3) {
  612. // CHECK:STDOUT: !definition:
  613. // CHECK:STDOUT: }
  614. // CHECK:STDOUT:
  615. // CHECK:STDOUT: specific @Y.WithSelf(constants.%Self.d4d) {
  616. // CHECK:STDOUT: !definition:
  617. // CHECK:STDOUT: }
  618. // CHECK:STDOUT:
  619. // CHECK:STDOUT: specific @C(constants.%V) {
  620. // CHECK:STDOUT: %V => constants.%V
  621. // CHECK:STDOUT: }
  622. // CHECK:STDOUT:
  623. // CHECK:STDOUT: specific @C(constants.%Z.facet.fd6) {
  624. // CHECK:STDOUT: %V => constants.%Z.facet.fd6
  625. // CHECK:STDOUT: }
  626. // CHECK:STDOUT:
  627. // CHECK:STDOUT: specific @U.as.Z.impl(constants.%U) {
  628. // CHECK:STDOUT: %U => constants.%U
  629. // CHECK:STDOUT: %Z.impl_witness => constants.%Z.impl_witness.856
  630. // CHECK:STDOUT: }
  631. // CHECK:STDOUT:
  632. // CHECK:STDOUT: specific @U.as.Z.impl(constants.%as_type) {
  633. // CHECK:STDOUT: %U => constants.%as_type
  634. // CHECK:STDOUT: %Z.impl_witness => constants.%Z.impl_witness.907
  635. // CHECK:STDOUT:
  636. // CHECK:STDOUT: !definition:
  637. // CHECK:STDOUT: }
  638. // CHECK:STDOUT:
  639. // CHECK:STDOUT: specific @I.WithSelf.F(constants.%Self.651) {
  640. // CHECK:STDOUT: %Self => constants.%Self.651
  641. // CHECK:STDOUT: %I.lookup_impl_witness => constants.%I.lookup_impl_witness.99c
  642. // CHECK:STDOUT: %impl.elem0 => constants.%impl.elem0.37f
  643. // CHECK:STDOUT: %as_type => constants.%as_type
  644. // CHECK:STDOUT: %.1 => constants.%.3cb
  645. // CHECK:STDOUT: %Z.lookup_impl_witness => constants.%Z.lookup_impl_witness
  646. // CHECK:STDOUT: %Z.facet => constants.%Z.facet.fd6
  647. // CHECK:STDOUT: %C => constants.%C.ffe
  648. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.be3
  649. // CHECK:STDOUT: }
  650. // CHECK:STDOUT:
  651. // CHECK:STDOUT: specific @I.WithSelf(constants.%.Self.1dc) {
  652. // CHECK:STDOUT: !definition:
  653. // CHECK:STDOUT: %Self => constants.%.Self.1dc
  654. // CHECK:STDOUT: %I.WithSelf.F.type => constants.%I.WithSelf.F.type.29d
  655. // CHECK:STDOUT: %I.WithSelf.F => constants.%I.WithSelf.F.8ec
  656. // CHECK:STDOUT: }
  657. // CHECK:STDOUT:
  658. // CHECK:STDOUT: specific @T.as.Y.impl(constants.%T) {
  659. // CHECK:STDOUT: %T => constants.%T
  660. // CHECK:STDOUT: %Y.impl_witness => constants.%Y.impl_witness.d43
  661. // CHECK:STDOUT: }
  662. // CHECK:STDOUT:
  663. // CHECK:STDOUT: specific @T.as.Y.impl(constants.%empty_tuple.type) {
  664. // CHECK:STDOUT: %T => constants.%empty_tuple.type
  665. // CHECK:STDOUT: %Y.impl_witness => constants.%Y.impl_witness.980
  666. // CHECK:STDOUT:
  667. // CHECK:STDOUT: !definition:
  668. // CHECK:STDOUT: }
  669. // CHECK:STDOUT:
  670. // CHECK:STDOUT: specific @D.as.I.impl(constants.%N) {
  671. // CHECK:STDOUT: %N.loc20_15.1 => constants.%N
  672. // CHECK:STDOUT: %D.loc20_24.1 => constants.%D
  673. // CHECK:STDOUT: %I.impl_witness.loc20_49.2 => constants.%I.impl_witness
  674. // CHECK:STDOUT:
  675. // CHECK:STDOUT: !definition:
  676. // CHECK:STDOUT: %D.as.I.impl.F.type => constants.%D.as.I.impl.F.type
  677. // CHECK:STDOUT: %D.as.I.impl.F => constants.%D.as.I.impl.F
  678. // CHECK:STDOUT: }
  679. // CHECK:STDOUT:
  680. // CHECK:STDOUT: specific @U.as.Z.impl(constants.%empty_tuple.type) {
  681. // CHECK:STDOUT: %U => constants.%empty_tuple.type
  682. // CHECK:STDOUT: %Z.impl_witness => constants.%Z.impl_witness.db1
  683. // CHECK:STDOUT:
  684. // CHECK:STDOUT: !definition:
  685. // CHECK:STDOUT: }
  686. // CHECK:STDOUT:
  687. // CHECK:STDOUT: specific @C(constants.%Z.facet.8bd) {
  688. // CHECK:STDOUT: %V => constants.%Z.facet.8bd
  689. // CHECK:STDOUT:
  690. // CHECK:STDOUT: !definition:
  691. // CHECK:STDOUT: }
  692. // CHECK:STDOUT:
  693. // CHECK:STDOUT: specific @D.as.I.impl.F(constants.%N) {}
  694. // CHECK:STDOUT:
  695. // CHECK:STDOUT: specific @I.WithSelf(constants.%I.facet) {
  696. // CHECK:STDOUT: !definition:
  697. // CHECK:STDOUT: %Self => constants.%I.facet
  698. // CHECK:STDOUT: %I.WithSelf.F.type => constants.%I.WithSelf.F.type.a33
  699. // CHECK:STDOUT: %I.WithSelf.F => constants.%I.WithSelf.F.b0f
  700. // CHECK:STDOUT: }
  701. // CHECK:STDOUT:
  702. // CHECK:STDOUT: specific @I.WithSelf.F(constants.%I.facet) {
  703. // CHECK:STDOUT: %Self => constants.%I.facet
  704. // CHECK:STDOUT: %I.lookup_impl_witness => constants.%I.impl_witness
  705. // CHECK:STDOUT: %impl.elem0 => constants.%Y.facet
  706. // CHECK:STDOUT: %as_type => constants.%empty_tuple.type
  707. // CHECK:STDOUT: %.1 => constants.%.194
  708. // CHECK:STDOUT: %Z.lookup_impl_witness => constants.%Z.impl_witness.db1
  709. // CHECK:STDOUT: %Z.facet => constants.%Z.facet.8bd
  710. // CHECK:STDOUT: %C => constants.%C.a44
  711. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.479
  712. // CHECK:STDOUT: }
  713. // CHECK:STDOUT: