import_self_specific.carbon 38 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/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(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.29b: %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: %T: type = symbolic_binding T, 0 [symbolic]
  61. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  62. // CHECK:STDOUT: %Y.impl_witness: <witness> = impl_witness file.%Y.impl_witness_table, @T.as.Y.impl(%T) [symbolic]
  63. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  64. // CHECK:STDOUT: %Self.3b3: %Z.type = symbolic_binding Self, 0 [symbolic]
  65. // CHECK:STDOUT: %U: type = symbolic_binding U, 0 [symbolic]
  66. // CHECK:STDOUT: %Z.impl_witness.5e4: <witness> = impl_witness file.%Z.impl_witness_table, @U.as.Z.impl(%U) [symbolic]
  67. // CHECK:STDOUT: %V: %Z.type = symbolic_binding V, 0 [symbolic]
  68. // CHECK:STDOUT: %pattern_type.4a0: type = pattern_type %Z.type [concrete]
  69. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  70. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  71. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  72. // CHECK:STDOUT: %C.4af: type = class_type @C, @C(%V) [symbolic]
  73. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  74. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_tuple.type [concrete]
  75. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  76. // CHECK:STDOUT: %Self.9f2: %I.type = symbolic_binding Self, 0 [symbolic]
  77. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  78. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%Assoc [concrete]
  79. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %Self.9f2, @I [symbolic]
  80. // CHECK:STDOUT: %impl.elem0: %Y.type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic]
  81. // CHECK:STDOUT: %as_type: type = facet_access_type %impl.elem0 [symbolic]
  82. // CHECK:STDOUT: %Z.impl_witness.58d: <witness> = impl_witness file.%Z.impl_witness_table, @U.as.Z.impl(%as_type) [symbolic]
  83. // CHECK:STDOUT: %Z.lookup_impl_witness: <witness> = lookup_impl_witness %impl.elem0, @Z [symbolic]
  84. // CHECK:STDOUT: %Z.facet: %Z.type = facet_value %as_type, (%Z.lookup_impl_witness) [symbolic]
  85. // CHECK:STDOUT: %C.a0e: type = class_type @C, @C(%Z.facet) [symbolic]
  86. // CHECK:STDOUT: %pattern_type.8e3: type = pattern_type %C.a0e [symbolic]
  87. // CHECK:STDOUT: %I.F.type: type = fn_type @I.F [concrete]
  88. // CHECK:STDOUT: %I.F: %I.F.type = struct_value () [concrete]
  89. // CHECK:STDOUT: %assoc1: %I.assoc_type = assoc_entity element1, @I.%I.F.decl [concrete]
  90. // CHECK:STDOUT: }
  91. // CHECK:STDOUT:
  92. // CHECK:STDOUT: file {
  93. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  94. // CHECK:STDOUT: .Y = %Y.decl
  95. // CHECK:STDOUT: .Z = %Z.decl
  96. // CHECK:STDOUT: .C = %C.decl
  97. // CHECK:STDOUT: .I = %I.decl
  98. // CHECK:STDOUT: }
  99. // CHECK:STDOUT: %Y.decl: type = interface_decl @Y [concrete = constants.%Y.type] {} {}
  100. // CHECK:STDOUT: impl_decl @T.as.Y.impl [concrete] {
  101. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  102. // CHECK:STDOUT: } {
  103. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc5_14.1 [symbolic = %T.loc5_14.2 (constants.%T)]
  104. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  105. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  106. // CHECK:STDOUT: %T.loc5_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc5_14.2 (constants.%T)]
  107. // CHECK:STDOUT: }
  108. // CHECK:STDOUT: %Y.impl_witness_table = impl_witness_table (), @T.as.Y.impl [concrete]
  109. // CHECK:STDOUT: %Y.impl_witness: <witness> = impl_witness %Y.impl_witness_table, @T.as.Y.impl(constants.%T) [symbolic = @T.as.Y.impl.%Y.impl_witness (constants.%Y.impl_witness)]
  110. // CHECK:STDOUT: %Z.decl: type = interface_decl @Z [concrete = constants.%Z.type] {} {}
  111. // CHECK:STDOUT: impl_decl @U.as.Z.impl [concrete] {
  112. // CHECK:STDOUT: %U.patt: %pattern_type.98f = symbolic_binding_pattern U, 0 [concrete]
  113. // CHECK:STDOUT: } {
  114. // CHECK:STDOUT: %U.ref: type = name_ref U, %U.loc9_14.1 [symbolic = %U.loc9_14.2 (constants.%U)]
  115. // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
  116. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  117. // CHECK:STDOUT: %U.loc9_14.1: type = symbolic_binding U, 0 [symbolic = %U.loc9_14.2 (constants.%U)]
  118. // CHECK:STDOUT: }
  119. // CHECK:STDOUT: %Z.impl_witness_table = impl_witness_table (), @U.as.Z.impl [concrete]
  120. // CHECK:STDOUT: %Z.impl_witness: <witness> = impl_witness %Z.impl_witness_table, @U.as.Z.impl(constants.%U) [symbolic = @U.as.Z.impl.%Z.impl_witness (constants.%Z.impl_witness.5e4)]
  121. // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] {
  122. // CHECK:STDOUT: %V.patt: %pattern_type.4a0 = symbolic_binding_pattern V, 0 [concrete]
  123. // CHECK:STDOUT: } {
  124. // CHECK:STDOUT: %.loc11: type = splice_block %Z.ref [concrete = constants.%Z.type] {
  125. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  126. // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
  127. // CHECK:STDOUT: }
  128. // CHECK:STDOUT: %V.loc11_9.2: %Z.type = symbolic_binding V, 0 [symbolic = %V.loc11_9.1 (constants.%V)]
  129. // CHECK:STDOUT: }
  130. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  131. // CHECK:STDOUT: }
  132. // CHECK:STDOUT:
  133. // CHECK:STDOUT: interface @Y {
  134. // CHECK:STDOUT: %Self: %Y.type = symbolic_binding Self, 0 [symbolic = constants.%Self.29b]
  135. // CHECK:STDOUT:
  136. // CHECK:STDOUT: !members:
  137. // CHECK:STDOUT: .Self = %Self
  138. // CHECK:STDOUT: witness = ()
  139. // CHECK:STDOUT:
  140. // CHECK:STDOUT: !requires:
  141. // CHECK:STDOUT: }
  142. // CHECK:STDOUT:
  143. // CHECK:STDOUT: interface @Z {
  144. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.3b3]
  145. // CHECK:STDOUT:
  146. // CHECK:STDOUT: !members:
  147. // CHECK:STDOUT: .Self = %Self
  148. // CHECK:STDOUT: witness = ()
  149. // CHECK:STDOUT:
  150. // CHECK:STDOUT: !requires:
  151. // CHECK:STDOUT: }
  152. // CHECK:STDOUT:
  153. // CHECK:STDOUT: interface @I {
  154. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self.9f2]
  155. // CHECK:STDOUT: %Assoc: %Y.type = assoc_const_decl @Assoc [concrete] {
  156. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%Assoc [concrete = constants.%assoc0]
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT: %I.F.decl: %I.F.type = fn_decl @I.F [concrete = constants.%I.F] {
  159. // CHECK:STDOUT: %c.patt: @I.F.%pattern_type (%pattern_type.8e3) = value_binding_pattern c [concrete]
  160. // CHECK:STDOUT: %c.param_patt: @I.F.%pattern_type (%pattern_type.8e3) = value_param_pattern %c.patt, call_param0 [concrete]
  161. // CHECK:STDOUT: } {
  162. // CHECK:STDOUT: %c.param: @I.F.%C.loc24_18.1 (%C.a0e) = value_param call_param0
  163. // CHECK:STDOUT: %.loc24_18.1: type = splice_block %C.loc24_18.2 [symbolic = %C.loc24_18.1 (constants.%C.a0e)] {
  164. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic]
  165. // 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)]
  166. // CHECK:STDOUT: %Assoc.ref: %Y.type = name_ref Assoc, %impl.elem0.loc24_13.2 [symbolic = %impl.elem0.loc24_13.1 (constants.%impl.elem0)]
  167. // CHECK:STDOUT: %Assoc.as_type: type = facet_access_type %Assoc.ref [symbolic = %as_type (constants.%as_type)]
  168. // 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)]
  169. // CHECK:STDOUT: %.loc24_18.2: %Z.type = converted %Assoc.ref, %Z.facet.loc24_18.2 [symbolic = %Z.facet.loc24_18.1 (constants.%Z.facet)]
  170. // CHECK:STDOUT: %C.loc24_18.2: type = class_type @C, @C(constants.%Z.facet) [symbolic = %C.loc24_18.1 (constants.%C.a0e)]
  171. // CHECK:STDOUT: }
  172. // CHECK:STDOUT: %c: @I.F.%C.loc24_18.1 (%C.a0e) = value_binding c, %c.param
  173. // CHECK:STDOUT: }
  174. // CHECK:STDOUT: %assoc1: %I.assoc_type = assoc_entity element1, %I.F.decl [concrete = constants.%assoc1]
  175. // CHECK:STDOUT:
  176. // CHECK:STDOUT: !members:
  177. // CHECK:STDOUT: .Self = %Self
  178. // CHECK:STDOUT: .Y = <poisoned>
  179. // CHECK:STDOUT: .Assoc = @Assoc.%assoc0
  180. // CHECK:STDOUT: .C = <poisoned>
  181. // CHECK:STDOUT: .F = %assoc1
  182. // CHECK:STDOUT: witness = (%Assoc, %I.F.decl)
  183. // CHECK:STDOUT:
  184. // CHECK:STDOUT: !requires:
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT:
  187. // CHECK:STDOUT: generic assoc_const @Assoc(@I.%Self: %I.type) {
  188. // CHECK:STDOUT: assoc_const Assoc:! %Y.type;
  189. // CHECK:STDOUT: }
  190. // CHECK:STDOUT:
  191. // CHECK:STDOUT: generic impl @T.as.Y.impl(%T.loc5_14.1: type) {
  192. // CHECK:STDOUT: %T.loc5_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc5_14.2 (constants.%T)]
  193. // CHECK:STDOUT: %Y.impl_witness: <witness> = impl_witness file.%Y.impl_witness_table, @T.as.Y.impl(%T.loc5_14.2) [symbolic = %Y.impl_witness (constants.%Y.impl_witness)]
  194. // CHECK:STDOUT:
  195. // CHECK:STDOUT: !definition:
  196. // CHECK:STDOUT:
  197. // CHECK:STDOUT: impl: %T.ref as %Y.ref {
  198. // CHECK:STDOUT: !members:
  199. // CHECK:STDOUT: witness = file.%Y.impl_witness
  200. // CHECK:STDOUT: }
  201. // CHECK:STDOUT: }
  202. // CHECK:STDOUT:
  203. // CHECK:STDOUT: generic impl @U.as.Z.impl(%U.loc9_14.1: type) {
  204. // CHECK:STDOUT: %U.loc9_14.2: type = symbolic_binding U, 0 [symbolic = %U.loc9_14.2 (constants.%U)]
  205. // CHECK:STDOUT: %Z.impl_witness: <witness> = impl_witness file.%Z.impl_witness_table, @U.as.Z.impl(%U.loc9_14.2) [symbolic = %Z.impl_witness (constants.%Z.impl_witness.5e4)]
  206. // CHECK:STDOUT:
  207. // CHECK:STDOUT: !definition:
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: impl: %U.ref as %Z.ref {
  210. // CHECK:STDOUT: !members:
  211. // CHECK:STDOUT: witness = file.%Z.impl_witness
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT: }
  214. // CHECK:STDOUT:
  215. // CHECK:STDOUT: generic class @C(%V.loc11_9.2: %Z.type) {
  216. // CHECK:STDOUT: %V.loc11_9.1: %Z.type = symbolic_binding V, 0 [symbolic = %V.loc11_9.1 (constants.%V)]
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: !definition:
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: class {
  221. // CHECK:STDOUT: %.loc12_10: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  222. // CHECK:STDOUT: %.loc12_11: type = converted %.loc12_10, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  223. // CHECK:STDOUT: adapt_decl %.loc12_11 [concrete]
  224. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_tuple.type [concrete = constants.%complete_type]
  225. // CHECK:STDOUT: complete_type_witness = %complete_type
  226. // CHECK:STDOUT:
  227. // CHECK:STDOUT: !members:
  228. // CHECK:STDOUT: .Self = constants.%C.4af
  229. // CHECK:STDOUT: }
  230. // CHECK:STDOUT: }
  231. // CHECK:STDOUT:
  232. // CHECK:STDOUT: generic fn @I.F(@I.%Self: %I.type) {
  233. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.9f2)]
  234. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %Self, @I [symbolic = %I.lookup_impl_witness (constants.%I.lookup_impl_witness)]
  235. // 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)]
  236. // CHECK:STDOUT: %as_type: type = facet_access_type %impl.elem0.loc24_13.1 [symbolic = %as_type (constants.%as_type)]
  237. // 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)]
  238. // 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)]
  239. // CHECK:STDOUT: %C.loc24_18.1: type = class_type @C, @C(%Z.facet.loc24_18.1) [symbolic = %C.loc24_18.1 (constants.%C.a0e)]
  240. // CHECK:STDOUT: %pattern_type: type = pattern_type %C.loc24_18.1 [symbolic = %pattern_type (constants.%pattern_type.8e3)]
  241. // CHECK:STDOUT:
  242. // CHECK:STDOUT: fn(%c.param: @I.F.%C.loc24_18.1 (%C.a0e));
  243. // CHECK:STDOUT: }
  244. // CHECK:STDOUT:
  245. // CHECK:STDOUT: specific @T.as.Y.impl(constants.%T) {
  246. // CHECK:STDOUT: %T.loc5_14.2 => constants.%T
  247. // CHECK:STDOUT: %Y.impl_witness => constants.%Y.impl_witness
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: specific @U.as.Z.impl(constants.%U) {
  251. // CHECK:STDOUT: %U.loc9_14.2 => constants.%U
  252. // CHECK:STDOUT: %Z.impl_witness => constants.%Z.impl_witness.5e4
  253. // CHECK:STDOUT: }
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: specific @C(constants.%V) {
  256. // CHECK:STDOUT: %V.loc11_9.1 => constants.%V
  257. // CHECK:STDOUT: }
  258. // CHECK:STDOUT:
  259. // CHECK:STDOUT: specific @Assoc(constants.%Self.9f2) {}
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: specific @U.as.Z.impl(constants.%as_type) {
  262. // CHECK:STDOUT: %U.loc9_14.2 => constants.%as_type
  263. // CHECK:STDOUT: %Z.impl_witness => constants.%Z.impl_witness.58d
  264. // CHECK:STDOUT:
  265. // CHECK:STDOUT: !definition:
  266. // CHECK:STDOUT: }
  267. // CHECK:STDOUT:
  268. // CHECK:STDOUT: specific @C(constants.%Z.facet) {
  269. // CHECK:STDOUT: %V.loc11_9.1 => constants.%Z.facet
  270. // CHECK:STDOUT: }
  271. // CHECK:STDOUT:
  272. // CHECK:STDOUT: specific @I.F(constants.%Self.9f2) {
  273. // CHECK:STDOUT: %Self => constants.%Self.9f2
  274. // CHECK:STDOUT: %I.lookup_impl_witness => constants.%I.lookup_impl_witness
  275. // CHECK:STDOUT: %impl.elem0.loc24_13.1 => constants.%impl.elem0
  276. // CHECK:STDOUT: %as_type => constants.%as_type
  277. // CHECK:STDOUT: %Z.lookup_impl_witness => constants.%Z.lookup_impl_witness
  278. // CHECK:STDOUT: %Z.facet.loc24_18.1 => constants.%Z.facet
  279. // CHECK:STDOUT: %C.loc24_18.1 => constants.%C.a0e
  280. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.8e3
  281. // CHECK:STDOUT: }
  282. // CHECK:STDOUT:
  283. // CHECK:STDOUT: --- impl_use.carbon
  284. // CHECK:STDOUT:
  285. // CHECK:STDOUT: constants {
  286. // CHECK:STDOUT: %E: type = class_type @E [concrete]
  287. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  288. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  289. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  290. // CHECK:STDOUT: %.Self.3b7: %type = symbolic_binding .Self [symbolic_self]
  291. // CHECK:STDOUT: %N: %E = symbolic_binding N, 0 [symbolic]
  292. // CHECK:STDOUT: %pattern_type.a4a: type = pattern_type %E [concrete]
  293. // CHECK:STDOUT: %D.type: type = generic_class_type @D [concrete]
  294. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  295. // CHECK:STDOUT: %D.generic: %D.type = struct_value () [concrete]
  296. // CHECK:STDOUT: %D: type = class_type @D, @D(%N) [symbolic]
  297. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  298. // CHECK:STDOUT: %Self.9f2: %I.type = symbolic_binding Self, 0 [symbolic]
  299. // CHECK:STDOUT: %.Self.420: %I.type = symbolic_binding .Self [symbolic_self]
  300. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  301. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.1d8 [concrete]
  302. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self.420 [symbolic_self]
  303. // CHECK:STDOUT: %I.lookup_impl_witness.fd8: <witness> = lookup_impl_witness %.Self.420, @I [symbolic_self]
  304. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  305. // CHECK:STDOUT: %impl.elem0.c51: %Y.type = impl_witness_access %I.lookup_impl_witness.fd8, element0 [symbolic_self]
  306. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  307. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  308. // CHECK:STDOUT: %Y.impl_witness.278: <witness> = impl_witness imports.%Y.impl_witness_table, @T.as.Y.impl(%T) [symbolic]
  309. // CHECK:STDOUT: %Y.impl_witness.8d4: <witness> = impl_witness imports.%Y.impl_witness_table, @T.as.Y.impl(%empty_tuple.type) [concrete]
  310. // CHECK:STDOUT: %Y.facet: %Y.type = facet_value %empty_tuple.type, (%Y.impl_witness.8d4) [concrete]
  311. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0.c51 = %Y.facet> [concrete]
  312. // CHECK:STDOUT: %I.F.type: type = fn_type @I.F [concrete]
  313. // CHECK:STDOUT: %I.F: %I.F.type = struct_value () [concrete]
  314. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  315. // CHECK:STDOUT: %I.lookup_impl_witness.9b0: <witness> = lookup_impl_witness %Self.9f2, @I [symbolic]
  316. // CHECK:STDOUT: %impl.elem0.d3e: %Y.type = impl_witness_access %I.lookup_impl_witness.9b0, element0 [symbolic]
  317. // CHECK:STDOUT: %Z.lookup_impl_witness: <witness> = lookup_impl_witness %impl.elem0.d3e, @Z [symbolic]
  318. // CHECK:STDOUT: %as_type: type = facet_access_type %impl.elem0.d3e [symbolic]
  319. // CHECK:STDOUT: %Z.facet.aa8: %Z.type = facet_value %as_type, (%Z.lookup_impl_witness) [symbolic]
  320. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  321. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  322. // CHECK:STDOUT: %complete_type.782: <witness> = complete_type_witness %empty_tuple.type [concrete]
  323. // CHECK:STDOUT: %V: %Z.type = symbolic_binding V, 0 [symbolic]
  324. // CHECK:STDOUT: %C.a0e: type = class_type @C, @C(%Z.facet.aa8) [symbolic]
  325. // CHECK:STDOUT: %pattern_type.8e3: type = pattern_type %C.a0e [symbolic]
  326. // CHECK:STDOUT: %U: type = symbolic_binding U, 0 [symbolic]
  327. // CHECK:STDOUT: %Z.impl_witness.5e4: <witness> = impl_witness imports.%Z.impl_witness_table, @U.as.Z.impl(%U) [symbolic]
  328. // CHECK:STDOUT: %Z.impl_witness.58d: <witness> = impl_witness imports.%Z.impl_witness_table, @U.as.Z.impl(%as_type) [symbolic]
  329. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table, @D.as.I.impl(%N) [symbolic]
  330. // CHECK:STDOUT: %Z.impl_witness.b07: <witness> = impl_witness imports.%Z.impl_witness_table, @U.as.Z.impl(%empty_tuple.type) [concrete]
  331. // CHECK:STDOUT: %Z.facet.996: %Z.type = facet_value %empty_tuple.type, (%Z.impl_witness.b07) [concrete]
  332. // CHECK:STDOUT: %C.3c2: type = class_type @C, @C(%Z.facet.996) [concrete]
  333. // CHECK:STDOUT: %pattern_type.b50: type = pattern_type %C.3c2 [concrete]
  334. // CHECK:STDOUT: %D.as.I.impl.F.type: type = fn_type @D.as.I.impl.F, @D.as.I.impl(%N) [symbolic]
  335. // CHECK:STDOUT: %D.as.I.impl.F: %D.as.I.impl.F.type = struct_value () [symbolic]
  336. // CHECK:STDOUT: %I.facet: %I.type = facet_value %D, (%I.impl_witness) [symbolic]
  337. // CHECK:STDOUT: }
  338. // CHECK:STDOUT:
  339. // CHECK:STDOUT: imports {
  340. // CHECK:STDOUT: %Main.Y = import_ref Main//impl_def, Y, unloaded
  341. // CHECK:STDOUT: %Main.Z = import_ref Main//impl_def, Z, unloaded
  342. // CHECK:STDOUT: %Main.C: %C.type = import_ref Main//impl_def, C, loaded [concrete = constants.%C.generic]
  343. // CHECK:STDOUT: %Main.I: type = import_ref Main//impl_def, I, loaded [concrete = constants.%I.type]
  344. // CHECK:STDOUT: %Main.import_ref.8df = import_ref Main//impl_def, loc15_13, unloaded
  345. // CHECK:STDOUT: %Main.import_ref.9ff: %I.assoc_type = import_ref Main//impl_def, loc16_12, loaded [concrete = constants.%assoc0]
  346. // CHECK:STDOUT: %Main.import_ref.abf = import_ref Main//impl_def, loc24_20, unloaded
  347. // CHECK:STDOUT: %Main.Assoc: %Y.type = import_ref Main//impl_def, Assoc, loaded [concrete = %Assoc]
  348. // CHECK:STDOUT: %Main.F: %I.F.type = import_ref Main//impl_def, F, loaded [concrete = constants.%I.F]
  349. // CHECK:STDOUT: %Main.import_ref.1d8: %Y.type = import_ref Main//impl_def, loc16_12, loaded [concrete = %Assoc]
  350. // CHECK:STDOUT: %Main.import_ref.581 = import_ref Main//impl_def, loc4_13, unloaded
  351. // CHECK:STDOUT: %Assoc: %Y.type = assoc_const_decl @Assoc [concrete] {}
  352. // CHECK:STDOUT: %Main.import_ref.e339be.1: %I.type = import_ref Main//impl_def, loc15_13, loaded [symbolic = constants.%Self.9f2]
  353. // CHECK:STDOUT: %Main.import_ref.338: <witness> = import_ref Main//impl_def, loc5_31, loaded [symbolic = @T.as.Y.impl.%Y.impl_witness (constants.%Y.impl_witness.278)]
  354. // CHECK:STDOUT: %Main.import_ref.efcd44.1: type = import_ref Main//impl_def, loc5_14, loaded [symbolic = @T.as.Y.impl.%T (constants.%T)]
  355. // CHECK:STDOUT: %Main.import_ref.cb5: type = import_ref Main//impl_def, loc5_24, loaded [symbolic = @T.as.Y.impl.%T (constants.%T)]
  356. // CHECK:STDOUT: %Main.import_ref.0a1: type = import_ref Main//impl_def, loc5_29, loaded [concrete = constants.%Y.type]
  357. // CHECK:STDOUT: %Y.impl_witness_table = impl_witness_table (), @T.as.Y.impl [concrete]
  358. // CHECK:STDOUT: %Main.import_ref.462 = import_ref Main//impl_def, loc8_13, unloaded
  359. // CHECK:STDOUT: %Main.import_ref.62f: %Z.type = import_ref Main//impl_def, loc11_9, loaded [symbolic = @C.%V (constants.%V)]
  360. // CHECK:STDOUT: %Main.import_ref.3fc: <witness> = import_ref Main//impl_def, loc13_1, loaded [concrete = constants.%complete_type.782]
  361. // CHECK:STDOUT: %Main.import_ref.f7e = import_ref Main//impl_def, inst{{[0-9A-F]+}} [no loc], unloaded
  362. // CHECK:STDOUT: %Main.import_ref.e339be.2: %I.type = import_ref Main//impl_def, loc15_13, loaded [symbolic = constants.%Self.9f2]
  363. // CHECK:STDOUT: %Main.import_ref.cfb: <witness> = import_ref Main//impl_def, loc9_31, loaded [symbolic = @U.as.Z.impl.%Z.impl_witness (constants.%Z.impl_witness.5e4)]
  364. // CHECK:STDOUT: %Main.import_ref.efcd44.2: type = import_ref Main//impl_def, loc9_14, loaded [symbolic = @U.as.Z.impl.%U (constants.%U)]
  365. // CHECK:STDOUT: %Main.import_ref.ff3: type = import_ref Main//impl_def, loc9_24, loaded [symbolic = @U.as.Z.impl.%U (constants.%U)]
  366. // CHECK:STDOUT: %Main.import_ref.df1: type = import_ref Main//impl_def, loc9_29, loaded [concrete = constants.%Z.type]
  367. // CHECK:STDOUT: %Z.impl_witness_table = impl_witness_table (), @U.as.Z.impl [concrete]
  368. // CHECK:STDOUT: }
  369. // CHECK:STDOUT:
  370. // CHECK:STDOUT: file {
  371. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  372. // CHECK:STDOUT: .Y = imports.%Main.Y
  373. // CHECK:STDOUT: .Z = imports.%Main.Z
  374. // CHECK:STDOUT: .C = imports.%Main.C
  375. // CHECK:STDOUT: .I = imports.%Main.I
  376. // CHECK:STDOUT: .E = %E.decl
  377. // CHECK:STDOUT: .D = %D.decl
  378. // CHECK:STDOUT: }
  379. // CHECK:STDOUT: %default.import = import <none>
  380. // CHECK:STDOUT: %E.decl: type = class_decl @E [concrete = constants.%E] {} {}
  381. // CHECK:STDOUT: %D.decl: %D.type = class_decl @D [concrete = constants.%D.generic] {
  382. // CHECK:STDOUT: %N.patt: %pattern_type.a4a = symbolic_binding_pattern N, 0 [concrete]
  383. // CHECK:STDOUT: } {
  384. // CHECK:STDOUT: %.loc7: type = splice_block %E.ref [concrete = constants.%E] {
  385. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.3b7]
  386. // CHECK:STDOUT: %E.ref: type = name_ref E, file.%E.decl [concrete = constants.%E]
  387. // CHECK:STDOUT: }
  388. // CHECK:STDOUT: %N.loc7_9.2: %E = symbolic_binding N, 0 [symbolic = %N.loc7_9.1 (constants.%N)]
  389. // CHECK:STDOUT: }
  390. // CHECK:STDOUT: impl_decl @D.as.I.impl [concrete] {
  391. // CHECK:STDOUT: %N.patt: %pattern_type.a4a = symbolic_binding_pattern N, 0 [concrete]
  392. // CHECK:STDOUT: } {
  393. // CHECK:STDOUT: %D.ref: %D.type = name_ref D, file.%D.decl [concrete = constants.%D.generic]
  394. // CHECK:STDOUT: %N.ref: %E = name_ref N, %N.loc20_14.2 [symbolic = %N.loc20_14.1 (constants.%N)]
  395. // CHECK:STDOUT: %D.loc20_24.2: type = class_type @D, @D(constants.%N) [symbolic = %D.loc20_24.1 (constants.%D)]
  396. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  397. // CHECK:STDOUT: %.Self.1: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self.420]
  398. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self.1 [symbolic_self = constants.%.Self.420]
  399. // CHECK:STDOUT: %Assoc.ref: %I.assoc_type = name_ref Assoc, imports.%Main.import_ref.9ff [concrete = constants.%assoc0]
  400. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  401. // CHECK:STDOUT: %.loc20_37: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  402. // CHECK:STDOUT: %impl.elem0: %Y.type = impl_witness_access constants.%I.lookup_impl_witness.fd8, element0 [symbolic_self = constants.%impl.elem0.c51]
  403. // CHECK:STDOUT: %.loc20_47.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  404. // CHECK:STDOUT: %Y.facet: %Y.type = facet_value constants.%empty_tuple.type, (constants.%Y.impl_witness.8d4) [concrete = constants.%Y.facet]
  405. // CHECK:STDOUT: %.loc20_47.2: %Y.type = converted %.loc20_47.1, %Y.facet [concrete = constants.%Y.facet]
  406. // CHECK:STDOUT: %.loc20_31: type = where_expr %.Self.1 [concrete = constants.%I_where.type] {
  407. // CHECK:STDOUT: requirement_base_facet_type constants.%I.type
  408. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc20_47.2
  409. // CHECK:STDOUT: }
  410. // CHECK:STDOUT: %.loc20_18: type = splice_block %E.ref [concrete = constants.%E] {
  411. // CHECK:STDOUT: %.Self.2: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.3b7]
  412. // CHECK:STDOUT: %E.ref: type = name_ref E, file.%E.decl [concrete = constants.%E]
  413. // CHECK:STDOUT: }
  414. // CHECK:STDOUT: %N.loc20_14.2: %E = symbolic_binding N, 0 [symbolic = %N.loc20_14.1 (constants.%N)]
  415. // CHECK:STDOUT: }
  416. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant, @D.as.I.impl.%D.as.I.impl.F.decl), @D.as.I.impl [concrete]
  417. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table, @D.as.I.impl(constants.%N) [symbolic = @D.as.I.impl.%I.impl_witness (constants.%I.impl_witness)]
  418. // CHECK:STDOUT: %impl_witness_assoc_constant: %Y.type = impl_witness_assoc_constant constants.%Y.facet [concrete = constants.%Y.facet]
  419. // CHECK:STDOUT: }
  420. // CHECK:STDOUT:
  421. // CHECK:STDOUT: interface @I [from "impl_def.carbon"] {
  422. // CHECK:STDOUT: !members:
  423. // CHECK:STDOUT: .Self = imports.%Main.import_ref.8df
  424. // CHECK:STDOUT: .Assoc = imports.%Main.import_ref.9ff
  425. // CHECK:STDOUT: .F = imports.%Main.import_ref.abf
  426. // CHECK:STDOUT: witness = (imports.%Main.Assoc, imports.%Main.F)
  427. // CHECK:STDOUT:
  428. // CHECK:STDOUT: !requires:
  429. // CHECK:STDOUT: }
  430. // CHECK:STDOUT:
  431. // CHECK:STDOUT: interface @Y [from "impl_def.carbon"] {
  432. // CHECK:STDOUT: !members:
  433. // CHECK:STDOUT: .Self = imports.%Main.import_ref.581
  434. // CHECK:STDOUT: witness = ()
  435. // CHECK:STDOUT:
  436. // CHECK:STDOUT: !requires:
  437. // CHECK:STDOUT: }
  438. // CHECK:STDOUT:
  439. // CHECK:STDOUT: interface @Z [from "impl_def.carbon"] {
  440. // CHECK:STDOUT: !members:
  441. // CHECK:STDOUT: .Self = imports.%Main.import_ref.462
  442. // CHECK:STDOUT: witness = ()
  443. // CHECK:STDOUT:
  444. // CHECK:STDOUT: !requires:
  445. // CHECK:STDOUT: }
  446. // CHECK:STDOUT:
  447. // CHECK:STDOUT: generic assoc_const @Assoc(imports.%Main.import_ref.e339be.1: %I.type) [from "impl_def.carbon"] {
  448. // CHECK:STDOUT: assoc_const Assoc:! %Y.type;
  449. // CHECK:STDOUT: }
  450. // CHECK:STDOUT:
  451. // CHECK:STDOUT: generic impl @T.as.Y.impl(imports.%Main.import_ref.efcd44.1: type) [from "impl_def.carbon"] {
  452. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)]
  453. // 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.278)]
  454. // CHECK:STDOUT:
  455. // CHECK:STDOUT: !definition:
  456. // CHECK:STDOUT:
  457. // CHECK:STDOUT: impl: imports.%Main.import_ref.cb5 as imports.%Main.import_ref.0a1 {
  458. // CHECK:STDOUT: !members:
  459. // CHECK:STDOUT: witness = imports.%Main.import_ref.338
  460. // CHECK:STDOUT: }
  461. // CHECK:STDOUT: }
  462. // CHECK:STDOUT:
  463. // CHECK:STDOUT: generic impl @U.as.Z.impl(imports.%Main.import_ref.efcd44.2: type) [from "impl_def.carbon"] {
  464. // CHECK:STDOUT: %U: type = symbolic_binding U, 0 [symbolic = %U (constants.%U)]
  465. // 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.5e4)]
  466. // CHECK:STDOUT:
  467. // CHECK:STDOUT: !definition:
  468. // CHECK:STDOUT:
  469. // CHECK:STDOUT: impl: imports.%Main.import_ref.ff3 as imports.%Main.import_ref.df1 {
  470. // CHECK:STDOUT: !members:
  471. // CHECK:STDOUT: witness = imports.%Main.import_ref.cfb
  472. // CHECK:STDOUT: }
  473. // CHECK:STDOUT: }
  474. // CHECK:STDOUT:
  475. // CHECK:STDOUT: generic impl @D.as.I.impl(%N.loc20_14.2: %E) {
  476. // CHECK:STDOUT: %N.loc20_14.1: %E = symbolic_binding N, 0 [symbolic = %N.loc20_14.1 (constants.%N)]
  477. // CHECK:STDOUT: %D.loc20_24.1: type = class_type @D, @D(%N.loc20_14.1) [symbolic = %D.loc20_24.1 (constants.%D)]
  478. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table, @D.as.I.impl(%N.loc20_14.1) [symbolic = %I.impl_witness (constants.%I.impl_witness)]
  479. // CHECK:STDOUT:
  480. // CHECK:STDOUT: !definition:
  481. // CHECK:STDOUT: %D.as.I.impl.F.type: type = fn_type @D.as.I.impl.F, @D.as.I.impl(%N.loc20_14.1) [symbolic = %D.as.I.impl.F.type (constants.%D.as.I.impl.F.type)]
  482. // 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)]
  483. // CHECK:STDOUT:
  484. // CHECK:STDOUT: impl: %D.loc20_24.2 as %.loc20_31 {
  485. // 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)] {
  486. // CHECK:STDOUT: %c.patt: %pattern_type.b50 = value_binding_pattern c [concrete]
  487. // CHECK:STDOUT: %c.param_patt: %pattern_type.b50 = value_param_pattern %c.patt, call_param0 [concrete]
  488. // CHECK:STDOUT: } {
  489. // CHECK:STDOUT: %c.param: %C.3c2 = value_param call_param0
  490. // CHECK:STDOUT: %.loc21_15.1: type = splice_block %C [concrete = constants.%C.3c2] {
  491. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Main.C [concrete = constants.%C.generic]
  492. // CHECK:STDOUT: %.loc21_14: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  493. // CHECK:STDOUT: %Z.facet: %Z.type = facet_value constants.%empty_tuple.type, (constants.%Z.impl_witness.b07) [concrete = constants.%Z.facet.996]
  494. // CHECK:STDOUT: %.loc21_15.2: %Z.type = converted %.loc21_14, %Z.facet [concrete = constants.%Z.facet.996]
  495. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%Z.facet.996) [concrete = constants.%C.3c2]
  496. // CHECK:STDOUT: }
  497. // CHECK:STDOUT: %c: %C.3c2 = value_binding c, %c.param
  498. // CHECK:STDOUT: }
  499. // CHECK:STDOUT:
  500. // CHECK:STDOUT: !members:
  501. // CHECK:STDOUT: .C = <poisoned>
  502. // CHECK:STDOUT: .F = %D.as.I.impl.F.decl
  503. // CHECK:STDOUT: witness = file.%I.impl_witness
  504. // CHECK:STDOUT: }
  505. // CHECK:STDOUT: }
  506. // CHECK:STDOUT:
  507. // CHECK:STDOUT: class @E {
  508. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357]
  509. // CHECK:STDOUT: complete_type_witness = %complete_type
  510. // CHECK:STDOUT:
  511. // CHECK:STDOUT: !members:
  512. // CHECK:STDOUT: .Self = constants.%E
  513. // CHECK:STDOUT: }
  514. // CHECK:STDOUT:
  515. // CHECK:STDOUT: generic class @D(%N.loc7_9.2: %E) {
  516. // CHECK:STDOUT: %N.loc7_9.1: %E = symbolic_binding N, 0 [symbolic = %N.loc7_9.1 (constants.%N)]
  517. // CHECK:STDOUT:
  518. // CHECK:STDOUT: !definition:
  519. // CHECK:STDOUT:
  520. // CHECK:STDOUT: class {
  521. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357]
  522. // CHECK:STDOUT: complete_type_witness = %complete_type
  523. // CHECK:STDOUT:
  524. // CHECK:STDOUT: !members:
  525. // CHECK:STDOUT: .Self = constants.%D
  526. // CHECK:STDOUT: }
  527. // CHECK:STDOUT: }
  528. // CHECK:STDOUT:
  529. // CHECK:STDOUT: generic class @C(imports.%Main.import_ref.62f: %Z.type) [from "impl_def.carbon"] {
  530. // CHECK:STDOUT: %V: %Z.type = symbolic_binding V, 0 [symbolic = %V (constants.%V)]
  531. // CHECK:STDOUT:
  532. // CHECK:STDOUT: !definition:
  533. // CHECK:STDOUT:
  534. // CHECK:STDOUT: class {
  535. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.3fc
  536. // CHECK:STDOUT:
  537. // CHECK:STDOUT: !members:
  538. // CHECK:STDOUT: .Self = imports.%Main.import_ref.f7e
  539. // CHECK:STDOUT: }
  540. // CHECK:STDOUT: }
  541. // CHECK:STDOUT:
  542. // CHECK:STDOUT: generic fn @I.F(imports.%Main.import_ref.e339be.2: %I.type) [from "impl_def.carbon"] {
  543. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.9f2)]
  544. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %Self, @I [symbolic = %I.lookup_impl_witness (constants.%I.lookup_impl_witness.9b0)]
  545. // CHECK:STDOUT: %impl.elem0: %Y.type = impl_witness_access %I.lookup_impl_witness, element0 [symbolic = %impl.elem0 (constants.%impl.elem0.d3e)]
  546. // CHECK:STDOUT: %as_type: type = facet_access_type %impl.elem0 [symbolic = %as_type (constants.%as_type)]
  547. // CHECK:STDOUT: %Z.lookup_impl_witness: <witness> = lookup_impl_witness %impl.elem0, @Z [symbolic = %Z.lookup_impl_witness (constants.%Z.lookup_impl_witness)]
  548. // CHECK:STDOUT: %Z.facet: %Z.type = facet_value %as_type, (%Z.lookup_impl_witness) [symbolic = %Z.facet (constants.%Z.facet.aa8)]
  549. // CHECK:STDOUT: %C: type = class_type @C, @C(%Z.facet) [symbolic = %C (constants.%C.a0e)]
  550. // CHECK:STDOUT: %pattern_type: type = pattern_type %C [symbolic = %pattern_type (constants.%pattern_type.8e3)]
  551. // CHECK:STDOUT:
  552. // CHECK:STDOUT: fn;
  553. // CHECK:STDOUT: }
  554. // CHECK:STDOUT:
  555. // CHECK:STDOUT: generic fn @D.as.I.impl.F(@D.as.I.impl.%N.loc20_14.2: %E) {
  556. // CHECK:STDOUT: !definition:
  557. // CHECK:STDOUT:
  558. // CHECK:STDOUT: fn(%c.param: %C.3c2) {
  559. // CHECK:STDOUT: !entry:
  560. // CHECK:STDOUT: return
  561. // CHECK:STDOUT: }
  562. // CHECK:STDOUT: }
  563. // CHECK:STDOUT:
  564. // CHECK:STDOUT: specific @D(constants.%N) {
  565. // CHECK:STDOUT: %N.loc7_9.1 => constants.%N
  566. // CHECK:STDOUT: }
  567. // CHECK:STDOUT:
  568. // CHECK:STDOUT: specific @Assoc(constants.%Self.9f2) {}
  569. // CHECK:STDOUT:
  570. // CHECK:STDOUT: specific @Assoc(constants.%.Self.420) {}
  571. // CHECK:STDOUT:
  572. // CHECK:STDOUT: specific @T.as.Y.impl(constants.%T) {
  573. // CHECK:STDOUT: %T => constants.%T
  574. // CHECK:STDOUT: %Y.impl_witness => constants.%Y.impl_witness.278
  575. // CHECK:STDOUT: }
  576. // CHECK:STDOUT:
  577. // CHECK:STDOUT: specific @T.as.Y.impl(constants.%empty_tuple.type) {
  578. // CHECK:STDOUT: %T => constants.%empty_tuple.type
  579. // CHECK:STDOUT: %Y.impl_witness => constants.%Y.impl_witness.8d4
  580. // CHECK:STDOUT:
  581. // CHECK:STDOUT: !definition:
  582. // CHECK:STDOUT: }
  583. // CHECK:STDOUT:
  584. // CHECK:STDOUT: specific @D.as.I.impl(constants.%N) {
  585. // CHECK:STDOUT: %N.loc20_14.1 => constants.%N
  586. // CHECK:STDOUT: %D.loc20_24.1 => constants.%D
  587. // CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness
  588. // CHECK:STDOUT:
  589. // CHECK:STDOUT: !definition:
  590. // CHECK:STDOUT: %D.as.I.impl.F.type => constants.%D.as.I.impl.F.type
  591. // CHECK:STDOUT: %D.as.I.impl.F => constants.%D.as.I.impl.F
  592. // CHECK:STDOUT: }
  593. // CHECK:STDOUT:
  594. // CHECK:STDOUT: specific @C(constants.%V) {
  595. // CHECK:STDOUT: %V => constants.%V
  596. // CHECK:STDOUT: }
  597. // CHECK:STDOUT:
  598. // CHECK:STDOUT: specific @C(constants.%Z.facet.aa8) {
  599. // CHECK:STDOUT: %V => constants.%Z.facet.aa8
  600. // CHECK:STDOUT: }
  601. // CHECK:STDOUT:
  602. // CHECK:STDOUT: specific @I.F(constants.%Self.9f2) {
  603. // CHECK:STDOUT: %Self => constants.%Self.9f2
  604. // CHECK:STDOUT: %I.lookup_impl_witness => constants.%I.lookup_impl_witness.9b0
  605. // CHECK:STDOUT: %impl.elem0 => constants.%impl.elem0.d3e
  606. // CHECK:STDOUT: %as_type => constants.%as_type
  607. // CHECK:STDOUT: %Z.lookup_impl_witness => constants.%Z.lookup_impl_witness
  608. // CHECK:STDOUT: %Z.facet => constants.%Z.facet.aa8
  609. // CHECK:STDOUT: %C => constants.%C.a0e
  610. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.8e3
  611. // CHECK:STDOUT: }
  612. // CHECK:STDOUT:
  613. // CHECK:STDOUT: specific @U.as.Z.impl(constants.%U) {
  614. // CHECK:STDOUT: %U => constants.%U
  615. // CHECK:STDOUT: %Z.impl_witness => constants.%Z.impl_witness.5e4
  616. // CHECK:STDOUT: }
  617. // CHECK:STDOUT:
  618. // CHECK:STDOUT: specific @U.as.Z.impl(constants.%as_type) {
  619. // CHECK:STDOUT: %U => constants.%as_type
  620. // CHECK:STDOUT: %Z.impl_witness => constants.%Z.impl_witness.58d
  621. // CHECK:STDOUT:
  622. // CHECK:STDOUT: !definition:
  623. // CHECK:STDOUT: }
  624. // CHECK:STDOUT:
  625. // CHECK:STDOUT: specific @U.as.Z.impl(constants.%empty_tuple.type) {
  626. // CHECK:STDOUT: %U => constants.%empty_tuple.type
  627. // CHECK:STDOUT: %Z.impl_witness => constants.%Z.impl_witness.b07
  628. // CHECK:STDOUT:
  629. // CHECK:STDOUT: !definition:
  630. // CHECK:STDOUT: }
  631. // CHECK:STDOUT:
  632. // CHECK:STDOUT: specific @C(constants.%Z.facet.996) {
  633. // CHECK:STDOUT: %V => constants.%Z.facet.996
  634. // CHECK:STDOUT:
  635. // CHECK:STDOUT: !definition:
  636. // CHECK:STDOUT: }
  637. // CHECK:STDOUT:
  638. // CHECK:STDOUT: specific @D.as.I.impl.F(constants.%N) {}
  639. // CHECK:STDOUT:
  640. // CHECK:STDOUT: specific @I.F(constants.%I.facet) {
  641. // CHECK:STDOUT: %Self => constants.%I.facet
  642. // CHECK:STDOUT: %I.lookup_impl_witness => constants.%I.impl_witness
  643. // CHECK:STDOUT: %impl.elem0 => constants.%Y.facet
  644. // CHECK:STDOUT: %as_type => constants.%empty_tuple.type
  645. // CHECK:STDOUT: %Z.lookup_impl_witness => constants.%Z.impl_witness.b07
  646. // CHECK:STDOUT: %Z.facet => constants.%Z.facet.996
  647. // CHECK:STDOUT: %C => constants.%C.3c2
  648. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.b50
  649. // CHECK:STDOUT: }
  650. // CHECK:STDOUT: