final.carbon 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  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/convert.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/final.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/final.carbon
  12. // --- require_complete_impl.carbon
  13. //@include-in-dumps
  14. library "[[@TEST_NAME]]";
  15. interface I { fn F(); }
  16. interface J {}
  17. final impl forall [T:! J] T as I { fn F() {} }
  18. // This is creating an indirection where the `final impl` requires an indirect
  19. // instantiation by the caller.
  20. fn UseI(T:! I) { T.F(); }
  21. fn UseJ(T:! J) { UseI(T); }
  22. class C {}
  23. impl C as J {}
  24. fn Use() { UseJ(C); }
  25. // CHECK:STDOUT: --- require_complete_impl.carbon
  26. // CHECK:STDOUT:
  27. // CHECK:STDOUT: constants {
  28. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  29. // CHECK:STDOUT: %Self.ab9: %I.type = symbolic_binding Self, 0 [symbolic]
  30. // CHECK:STDOUT: %I.WithSelf.F.type.08c: type = fn_type @I.WithSelf.F, @I.WithSelf(%Self.ab9) [symbolic]
  31. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  32. // CHECK:STDOUT: %I.WithSelf.F.705: %I.WithSelf.F.type.08c = struct_value () [symbolic]
  33. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  34. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%I.WithSelf.F.decl [concrete]
  35. // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete]
  36. // CHECK:STDOUT: %Self.8a1: %J.type = symbolic_binding Self, 0 [symbolic]
  37. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  38. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  39. // CHECK:STDOUT: %pattern_type.f76: type = pattern_type %J.type [concrete]
  40. // CHECK:STDOUT: %T.612: %J.type = symbolic_binding T, 0 [symbolic]
  41. // CHECK:STDOUT: %T.binding.as_type.50b: type = symbolic_binding_type T, 0, %T.612 [symbolic]
  42. // CHECK:STDOUT: %I.impl_witness.ada: <witness> = impl_witness @T.binding.as_type.as.I.impl.%I.impl_witness_table, @T.binding.as_type.as.I.impl(%T.612) [symbolic]
  43. // CHECK:STDOUT: %T.binding.as_type.as.I.impl.F.type.060: type = fn_type @T.binding.as_type.as.I.impl.F, @T.binding.as_type.as.I.impl(%T.612) [symbolic]
  44. // CHECK:STDOUT: %T.binding.as_type.as.I.impl.F.ded: %T.binding.as_type.as.I.impl.F.type.060 = struct_value () [symbolic]
  45. // CHECK:STDOUT: %I.facet.af5: %I.type = facet_value %T.binding.as_type.50b, (%I.impl_witness.ada) [symbolic]
  46. // CHECK:STDOUT: %I.WithSelf.F.type.7d2: type = fn_type @I.WithSelf.F, @I.WithSelf(%I.facet.af5) [symbolic]
  47. // CHECK:STDOUT: %I.WithSelf.F.bc8: %I.WithSelf.F.type.7d2 = struct_value () [symbolic]
  48. // CHECK:STDOUT: %pattern_type.9d9: type = pattern_type %I.type [concrete]
  49. // CHECK:STDOUT: %T.651: %I.type = symbolic_binding T, 0 [symbolic]
  50. // CHECK:STDOUT: %UseI.type: type = fn_type @UseI [concrete]
  51. // CHECK:STDOUT: %UseI: %UseI.type = struct_value () [concrete]
  52. // CHECK:STDOUT: %I.WithSelf.F.type.a1f: type = fn_type @I.WithSelf.F, @I.WithSelf(%T.651) [symbolic]
  53. // CHECK:STDOUT: %I.WithSelf.F.cc3: %I.WithSelf.F.type.a1f = struct_value () [symbolic]
  54. // CHECK:STDOUT: %T.binding.as_type.3af: type = symbolic_binding_type T, 0, %T.651 [symbolic]
  55. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %T.651, @I [symbolic]
  56. // CHECK:STDOUT: %.7d0: type = fn_type_with_self_type %I.WithSelf.F.type.a1f, %T.651 [symbolic]
  57. // CHECK:STDOUT: %impl.elem0: %.7d0 = impl_witness_access %I.lookup_impl_witness, element0 [symbolic]
  58. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @I.WithSelf.F(%T.651) [symbolic]
  59. // CHECK:STDOUT: %UseJ.type: type = fn_type @UseJ [concrete]
  60. // CHECK:STDOUT: %UseJ: %UseJ.type = struct_value () [concrete]
  61. // CHECK:STDOUT: %.f66: require_specific_def_type = require_specific_def @T.binding.as_type.as.I.impl(%T.612) [symbolic]
  62. // CHECK:STDOUT: %UseI.specific_fn.5d2: <specific function> = specific_function %UseI, @UseI(%I.facet.af5) [symbolic]
  63. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  64. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  65. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  66. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness @C.as.J.impl.%J.impl_witness_table [concrete]
  67. // CHECK:STDOUT: %J.facet: %J.type = facet_value %C, (%J.impl_witness) [concrete]
  68. // CHECK:STDOUT: %Use.type: type = fn_type @Use [concrete]
  69. // CHECK:STDOUT: %Use: %Use.type = struct_value () [concrete]
  70. // CHECK:STDOUT: %UseJ.specific_fn: <specific function> = specific_function %UseJ, @UseJ(%J.facet) [concrete]
  71. // CHECK:STDOUT: %.623: type = fn_type_with_self_type %I.WithSelf.F.type.7d2, %I.facet.af5 [symbolic]
  72. // CHECK:STDOUT: %T.binding.as_type.as.I.impl.F.specific_fn.95b: <specific function> = specific_function %T.binding.as_type.as.I.impl.F.ded, @T.binding.as_type.as.I.impl.F(%T.612) [symbolic]
  73. // CHECK:STDOUT: %I.impl_witness.9a0: <witness> = impl_witness @T.binding.as_type.as.I.impl.%I.impl_witness_table, @T.binding.as_type.as.I.impl(%J.facet) [concrete]
  74. // CHECK:STDOUT: %T.binding.as_type.as.I.impl.F.type.9f7: type = fn_type @T.binding.as_type.as.I.impl.F, @T.binding.as_type.as.I.impl(%J.facet) [concrete]
  75. // CHECK:STDOUT: %T.binding.as_type.as.I.impl.F.698: %T.binding.as_type.as.I.impl.F.type.9f7 = struct_value () [concrete]
  76. // CHECK:STDOUT: %.d61: require_specific_def_type = require_specific_def @T.binding.as_type.as.I.impl(%J.facet) [concrete]
  77. // CHECK:STDOUT: %I.facet.2df: %I.type = facet_value %C, (%I.impl_witness.9a0) [concrete]
  78. // CHECK:STDOUT: %UseI.specific_fn.163: <specific function> = specific_function %UseI, @UseI(%I.facet.2df) [concrete]
  79. // CHECK:STDOUT: %I.WithSelf.F.type.1b3: type = fn_type @I.WithSelf.F, @I.WithSelf(%I.facet.2df) [concrete]
  80. // CHECK:STDOUT: %.a11: type = fn_type_with_self_type %I.WithSelf.F.type.1b3, %I.facet.2df [concrete]
  81. // CHECK:STDOUT: %T.binding.as_type.as.I.impl.F.specific_fn.78c: <specific function> = specific_function %T.binding.as_type.as.I.impl.F.698, @T.binding.as_type.as.I.impl.F(%J.facet) [concrete]
  82. // CHECK:STDOUT: }
  83. // CHECK:STDOUT:
  84. // CHECK:STDOUT: imports {
  85. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  86. // CHECK:STDOUT: import Core//prelude
  87. // CHECK:STDOUT: import Core//prelude/...
  88. // CHECK:STDOUT: }
  89. // CHECK:STDOUT: }
  90. // CHECK:STDOUT:
  91. // CHECK:STDOUT: file {
  92. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  93. // CHECK:STDOUT: .Core = imports.%Core
  94. // CHECK:STDOUT: .I = %I.decl
  95. // CHECK:STDOUT: .J = %J.decl
  96. // CHECK:STDOUT: .UseI = %UseI.decl
  97. // CHECK:STDOUT: .UseJ = %UseJ.decl
  98. // CHECK:STDOUT: .C = %C.decl
  99. // CHECK:STDOUT: .Use = %Use.decl
  100. // CHECK:STDOUT: }
  101. // CHECK:STDOUT: %Core.import = import Core
  102. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  103. // CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {}
  104. // CHECK:STDOUT: impl_decl @T.binding.as_type.as.I.impl [concrete] {
  105. // CHECK:STDOUT: %T.patt: %pattern_type.f76 = symbolic_binding_pattern T, 0 [concrete]
  106. // CHECK:STDOUT: } {
  107. // CHECK:STDOUT: %T.ref: %J.type = name_ref T, %T.loc7_21.2 [symbolic = %T.loc7_21.1 (constants.%T.612)]
  108. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T.ref [symbolic = %T.binding.as_type (constants.%T.binding.as_type.50b)]
  109. // CHECK:STDOUT: %.loc7_27: type = converted %T.ref, %T.as_type [symbolic = %T.binding.as_type (constants.%T.binding.as_type.50b)]
  110. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  111. // CHECK:STDOUT: %.loc7_24: type = splice_block %J.ref [concrete = constants.%J.type] {
  112. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  113. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  114. // CHECK:STDOUT: }
  115. // CHECK:STDOUT: %T.loc7_21.2: %J.type = symbolic_binding T, 0 [symbolic = %T.loc7_21.1 (constants.%T.612)]
  116. // CHECK:STDOUT: }
  117. // CHECK:STDOUT: %UseI.decl: %UseI.type = fn_decl @UseI [concrete = constants.%UseI] {
  118. // CHECK:STDOUT: %T.patt: %pattern_type.9d9 = symbolic_binding_pattern T, 0 [concrete]
  119. // CHECK:STDOUT: } {
  120. // CHECK:STDOUT: %.loc11_13: type = splice_block %I.ref [concrete = constants.%I.type] {
  121. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  122. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  123. // CHECK:STDOUT: }
  124. // CHECK:STDOUT: %T.loc11_10.2: %I.type = symbolic_binding T, 0 [symbolic = %T.loc11_10.1 (constants.%T.651)]
  125. // CHECK:STDOUT: }
  126. // CHECK:STDOUT: %UseJ.decl: %UseJ.type = fn_decl @UseJ [concrete = constants.%UseJ] {
  127. // CHECK:STDOUT: %T.patt: %pattern_type.f76 = symbolic_binding_pattern T, 0 [concrete]
  128. // CHECK:STDOUT: } {
  129. // CHECK:STDOUT: %.loc12_13: type = splice_block %J.ref [concrete = constants.%J.type] {
  130. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  131. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  132. // CHECK:STDOUT: }
  133. // CHECK:STDOUT: %T.loc12_10.2: %J.type = symbolic_binding T, 0 [symbolic = %T.loc12_10.1 (constants.%T.612)]
  134. // CHECK:STDOUT: }
  135. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  136. // CHECK:STDOUT: impl_decl @C.as.J.impl [concrete] {} {
  137. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  138. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  139. // CHECK:STDOUT: }
  140. // CHECK:STDOUT: %Use.decl: %Use.type = fn_decl @Use [concrete = constants.%Use] {} {}
  141. // CHECK:STDOUT: }
  142. // CHECK:STDOUT:
  143. // CHECK:STDOUT: interface @I {
  144. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self.ab9]
  145. // CHECK:STDOUT: %I.WithSelf.decl = interface_with_self_decl @I [concrete]
  146. // CHECK:STDOUT:
  147. // CHECK:STDOUT: !with Self:
  148. // CHECK:STDOUT: %I.WithSelf.F.decl: @I.WithSelf.%I.WithSelf.F.type (%I.WithSelf.F.type.08c) = fn_decl @I.WithSelf.F [symbolic = @I.WithSelf.%I.WithSelf.F (constants.%I.WithSelf.F.705)] {} {}
  149. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %I.WithSelf.F.decl [concrete = constants.%assoc0]
  150. // CHECK:STDOUT:
  151. // CHECK:STDOUT: !members:
  152. // CHECK:STDOUT: .Self = %Self
  153. // CHECK:STDOUT: .F = @I.WithSelf.%assoc0
  154. // CHECK:STDOUT: witness = (@I.WithSelf.%I.WithSelf.F.decl)
  155. // CHECK:STDOUT:
  156. // CHECK:STDOUT: !requires:
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT:
  159. // CHECK:STDOUT: interface @J {
  160. // CHECK:STDOUT: %Self: %J.type = symbolic_binding Self, 0 [symbolic = constants.%Self.8a1]
  161. // CHECK:STDOUT: %J.WithSelf.decl = interface_with_self_decl @J [concrete]
  162. // CHECK:STDOUT:
  163. // CHECK:STDOUT: !members:
  164. // CHECK:STDOUT: .Self = %Self
  165. // CHECK:STDOUT: witness = ()
  166. // CHECK:STDOUT:
  167. // CHECK:STDOUT: !requires:
  168. // CHECK:STDOUT: }
  169. // CHECK:STDOUT:
  170. // CHECK:STDOUT: generic impl @T.binding.as_type.as.I.impl(%T.loc7_21.2: %J.type) {
  171. // CHECK:STDOUT: %T.loc7_21.1: %J.type = symbolic_binding T, 0 [symbolic = %T.loc7_21.1 (constants.%T.612)]
  172. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.loc7_21.1 [symbolic = %T.binding.as_type (constants.%T.binding.as_type.50b)]
  173. // CHECK:STDOUT: %I.impl_witness.loc7_34.2: <witness> = impl_witness %I.impl_witness_table, @T.binding.as_type.as.I.impl(%T.loc7_21.1) [symbolic = %I.impl_witness.loc7_34.2 (constants.%I.impl_witness.ada)]
  174. // CHECK:STDOUT:
  175. // CHECK:STDOUT: !definition:
  176. // CHECK:STDOUT: %T.binding.as_type.as.I.impl.F.type: type = fn_type @T.binding.as_type.as.I.impl.F, @T.binding.as_type.as.I.impl(%T.loc7_21.1) [symbolic = %T.binding.as_type.as.I.impl.F.type (constants.%T.binding.as_type.as.I.impl.F.type.060)]
  177. // CHECK:STDOUT: %T.binding.as_type.as.I.impl.F: @T.binding.as_type.as.I.impl.%T.binding.as_type.as.I.impl.F.type (%T.binding.as_type.as.I.impl.F.type.060) = struct_value () [symbolic = %T.binding.as_type.as.I.impl.F (constants.%T.binding.as_type.as.I.impl.F.ded)]
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: impl: %.loc7_27 as %I.ref {
  180. // CHECK:STDOUT: %T.binding.as_type.as.I.impl.F.decl: @T.binding.as_type.as.I.impl.%T.binding.as_type.as.I.impl.F.type (%T.binding.as_type.as.I.impl.F.type.060) = fn_decl @T.binding.as_type.as.I.impl.F [symbolic = @T.binding.as_type.as.I.impl.%T.binding.as_type.as.I.impl.F (constants.%T.binding.as_type.as.I.impl.F.ded)] {} {}
  181. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%T.binding.as_type.as.I.impl.F.decl), @T.binding.as_type.as.I.impl [concrete]
  182. // CHECK:STDOUT: %I.impl_witness.loc7_34.1: <witness> = impl_witness %I.impl_witness_table, @T.binding.as_type.as.I.impl(constants.%T.612) [symbolic = %I.impl_witness.loc7_34.2 (constants.%I.impl_witness.ada)]
  183. // CHECK:STDOUT:
  184. // CHECK:STDOUT: !members:
  185. // CHECK:STDOUT: .F = %T.binding.as_type.as.I.impl.F.decl
  186. // CHECK:STDOUT: witness = %I.impl_witness.loc7_34.1
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT:
  190. // CHECK:STDOUT: impl @C.as.J.impl: %C.ref as %J.ref {
  191. // CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (), @C.as.J.impl [concrete]
  192. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness]
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: !members:
  195. // CHECK:STDOUT: witness = %J.impl_witness
  196. // CHECK:STDOUT: }
  197. // CHECK:STDOUT:
  198. // CHECK:STDOUT: class @C {
  199. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  200. // CHECK:STDOUT: complete_type_witness = %complete_type
  201. // CHECK:STDOUT:
  202. // CHECK:STDOUT: !members:
  203. // CHECK:STDOUT: .Self = constants.%C
  204. // CHECK:STDOUT: }
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: generic fn @I.WithSelf.F(@I.%Self: %I.type) {
  207. // CHECK:STDOUT: fn();
  208. // CHECK:STDOUT: }
  209. // CHECK:STDOUT:
  210. // CHECK:STDOUT: generic fn @T.binding.as_type.as.I.impl.F(@T.binding.as_type.as.I.impl.%T.loc7_21.2: %J.type) {
  211. // CHECK:STDOUT: !definition:
  212. // CHECK:STDOUT:
  213. // CHECK:STDOUT: fn() {
  214. // CHECK:STDOUT: !entry:
  215. // CHECK:STDOUT: return
  216. // CHECK:STDOUT: }
  217. // CHECK:STDOUT: }
  218. // CHECK:STDOUT:
  219. // CHECK:STDOUT: generic fn @UseI(%T.loc11_10.2: %I.type) {
  220. // CHECK:STDOUT: %T.loc11_10.1: %I.type = symbolic_binding T, 0 [symbolic = %T.loc11_10.1 (constants.%T.651)]
  221. // CHECK:STDOUT:
  222. // CHECK:STDOUT: !definition:
  223. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.loc11_10.1 [symbolic = %T.binding.as_type (constants.%T.binding.as_type.3af)]
  224. // CHECK:STDOUT: %I.WithSelf.F.type: type = fn_type @I.WithSelf.F, @I.WithSelf(%T.loc11_10.1) [symbolic = %I.WithSelf.F.type (constants.%I.WithSelf.F.type.a1f)]
  225. // CHECK:STDOUT: %.loc11_19.2: type = fn_type_with_self_type %I.WithSelf.F.type, %T.loc11_10.1 [symbolic = %.loc11_19.2 (constants.%.7d0)]
  226. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc11_10.1, @I [symbolic = %I.lookup_impl_witness (constants.%I.lookup_impl_witness)]
  227. // CHECK:STDOUT: %impl.elem0.loc11_19.2: @UseI.%.loc11_19.2 (%.7d0) = impl_witness_access %I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc11_19.2 (constants.%impl.elem0)]
  228. // CHECK:STDOUT: %specific_impl_fn.loc11_19.2: <specific function> = specific_impl_function %impl.elem0.loc11_19.2, @I.WithSelf.F(%T.loc11_10.1) [symbolic = %specific_impl_fn.loc11_19.2 (constants.%specific_impl_fn)]
  229. // CHECK:STDOUT:
  230. // CHECK:STDOUT: fn() {
  231. // CHECK:STDOUT: !entry:
  232. // CHECK:STDOUT: %T.ref: %I.type = name_ref T, %T.loc11_10.2 [symbolic = %T.loc11_10.1 (constants.%T.651)]
  233. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T.ref [symbolic = %T.binding.as_type (constants.%T.binding.as_type.3af)]
  234. // CHECK:STDOUT: %.loc11_19.1: type = converted %T.ref, %T.as_type [symbolic = %T.binding.as_type (constants.%T.binding.as_type.3af)]
  235. // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, @I.WithSelf.%assoc0 [concrete = constants.%assoc0]
  236. // CHECK:STDOUT: %impl.elem0.loc11_19.1: @UseI.%.loc11_19.2 (%.7d0) = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc11_19.2 (constants.%impl.elem0)]
  237. // CHECK:STDOUT: %specific_impl_fn.loc11_19.1: <specific function> = specific_impl_function %impl.elem0.loc11_19.1, @I.WithSelf.F(constants.%T.651) [symbolic = %specific_impl_fn.loc11_19.2 (constants.%specific_impl_fn)]
  238. // CHECK:STDOUT: %I.WithSelf.F.call: init %empty_tuple.type = call %specific_impl_fn.loc11_19.1()
  239. // CHECK:STDOUT: return
  240. // CHECK:STDOUT: }
  241. // CHECK:STDOUT: }
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: generic fn @UseJ(%T.loc12_10.2: %J.type) {
  244. // CHECK:STDOUT: %T.loc12_10.1: %J.type = symbolic_binding T, 0 [symbolic = %T.loc12_10.1 (constants.%T.612)]
  245. // CHECK:STDOUT:
  246. // CHECK:STDOUT: !definition:
  247. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.loc12_10.1 [symbolic = %T.binding.as_type (constants.%T.binding.as_type.50b)]
  248. // CHECK:STDOUT: %.loc12_24.2: require_specific_def_type = require_specific_def @T.binding.as_type.as.I.impl(%T.loc12_10.1) [symbolic = %.loc12_24.2 (constants.%.f66)]
  249. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness @T.binding.as_type.as.I.impl.%I.impl_witness_table, @T.binding.as_type.as.I.impl(%T.loc12_10.1) [symbolic = %I.impl_witness (constants.%I.impl_witness.ada)]
  250. // CHECK:STDOUT: %I.facet.loc12_24.2: %I.type = facet_value %T.binding.as_type, (%I.impl_witness) [symbolic = %I.facet.loc12_24.2 (constants.%I.facet.af5)]
  251. // CHECK:STDOUT: %UseI.specific_fn.loc12_18.2: <specific function> = specific_function constants.%UseI, @UseI(%I.facet.loc12_24.2) [symbolic = %UseI.specific_fn.loc12_18.2 (constants.%UseI.specific_fn.5d2)]
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: fn() {
  254. // CHECK:STDOUT: !entry:
  255. // CHECK:STDOUT: %UseI.ref: %UseI.type = name_ref UseI, file.%UseI.decl [concrete = constants.%UseI]
  256. // CHECK:STDOUT: %T.ref: %J.type = name_ref T, %T.loc12_10.2 [symbolic = %T.loc12_10.1 (constants.%T.612)]
  257. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T.ref [symbolic = %T.binding.as_type (constants.%T.binding.as_type.50b)]
  258. // CHECK:STDOUT: %I.facet.loc12_24.1: %I.type = facet_value %T.as_type, (constants.%I.impl_witness.ada) [symbolic = %I.facet.loc12_24.2 (constants.%I.facet.af5)]
  259. // CHECK:STDOUT: %.loc12_24.1: %I.type = converted %T.ref, %I.facet.loc12_24.1 [symbolic = %I.facet.loc12_24.2 (constants.%I.facet.af5)]
  260. // CHECK:STDOUT: %UseI.specific_fn.loc12_18.1: <specific function> = specific_function %UseI.ref, @UseI(constants.%I.facet.af5) [symbolic = %UseI.specific_fn.loc12_18.2 (constants.%UseI.specific_fn.5d2)]
  261. // CHECK:STDOUT: %UseI.call: init %empty_tuple.type = call %UseI.specific_fn.loc12_18.1()
  262. // CHECK:STDOUT: return
  263. // CHECK:STDOUT: }
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT:
  266. // CHECK:STDOUT: fn @Use() {
  267. // CHECK:STDOUT: !entry:
  268. // CHECK:STDOUT: %UseJ.ref: %UseJ.type = name_ref UseJ, file.%UseJ.decl [concrete = constants.%UseJ]
  269. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  270. // CHECK:STDOUT: %J.facet: %J.type = facet_value %C.ref, (constants.%J.impl_witness) [concrete = constants.%J.facet]
  271. // CHECK:STDOUT: %.loc16: %J.type = converted %C.ref, %J.facet [concrete = constants.%J.facet]
  272. // CHECK:STDOUT: %UseJ.specific_fn: <specific function> = specific_function %UseJ.ref, @UseJ(constants.%J.facet) [concrete = constants.%UseJ.specific_fn]
  273. // CHECK:STDOUT: %UseJ.call: init %empty_tuple.type = call %UseJ.specific_fn()
  274. // CHECK:STDOUT: return
  275. // CHECK:STDOUT: }
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: specific @I.WithSelf(constants.%Self.ab9) {
  278. // CHECK:STDOUT: !definition:
  279. // CHECK:STDOUT: %Self => constants.%Self.ab9
  280. // CHECK:STDOUT: %I.WithSelf.F.type => constants.%I.WithSelf.F.type.08c
  281. // CHECK:STDOUT: %I.WithSelf.F => constants.%I.WithSelf.F.705
  282. // CHECK:STDOUT: }
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: specific @I.WithSelf.F(constants.%Self.ab9) {}
  285. // CHECK:STDOUT:
  286. // CHECK:STDOUT: specific @J.WithSelf(constants.%Self.8a1) {
  287. // CHECK:STDOUT: !definition:
  288. // CHECK:STDOUT: }
  289. // CHECK:STDOUT:
  290. // CHECK:STDOUT: specific @T.binding.as_type.as.I.impl(constants.%T.612) {
  291. // CHECK:STDOUT: %T.loc7_21.1 => constants.%T.612
  292. // CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type.50b
  293. // CHECK:STDOUT: %I.impl_witness.loc7_34.2 => constants.%I.impl_witness.ada
  294. // CHECK:STDOUT:
  295. // CHECK:STDOUT: !definition:
  296. // CHECK:STDOUT: %T.binding.as_type.as.I.impl.F.type => constants.%T.binding.as_type.as.I.impl.F.type.060
  297. // CHECK:STDOUT: %T.binding.as_type.as.I.impl.F => constants.%T.binding.as_type.as.I.impl.F.ded
  298. // CHECK:STDOUT: }
  299. // CHECK:STDOUT:
  300. // CHECK:STDOUT: specific @T.binding.as_type.as.I.impl.F(constants.%T.612) {
  301. // CHECK:STDOUT: !definition:
  302. // CHECK:STDOUT: }
  303. // CHECK:STDOUT:
  304. // CHECK:STDOUT: specific @I.WithSelf(constants.%I.facet.af5) {
  305. // CHECK:STDOUT: !definition:
  306. // CHECK:STDOUT: %Self => constants.%I.facet.af5
  307. // CHECK:STDOUT: %I.WithSelf.F.type => constants.%I.WithSelf.F.type.7d2
  308. // CHECK:STDOUT: %I.WithSelf.F => constants.%I.WithSelf.F.bc8
  309. // CHECK:STDOUT: }
  310. // CHECK:STDOUT:
  311. // CHECK:STDOUT: specific @I.WithSelf.F(constants.%I.facet.af5) {}
  312. // CHECK:STDOUT:
  313. // CHECK:STDOUT: specific @UseI(constants.%T.651) {
  314. // CHECK:STDOUT: %T.loc11_10.1 => constants.%T.651
  315. // CHECK:STDOUT: }
  316. // CHECK:STDOUT:
  317. // CHECK:STDOUT: specific @I.WithSelf(constants.%T.651) {
  318. // CHECK:STDOUT: !definition:
  319. // CHECK:STDOUT: %Self => constants.%T.651
  320. // CHECK:STDOUT: %I.WithSelf.F.type => constants.%I.WithSelf.F.type.a1f
  321. // CHECK:STDOUT: %I.WithSelf.F => constants.%I.WithSelf.F.cc3
  322. // CHECK:STDOUT: }
  323. // CHECK:STDOUT:
  324. // CHECK:STDOUT: specific @I.WithSelf.F(constants.%T.651) {}
  325. // CHECK:STDOUT:
  326. // CHECK:STDOUT: specific @UseJ(constants.%T.612) {
  327. // CHECK:STDOUT: %T.loc12_10.1 => constants.%T.612
  328. // CHECK:STDOUT: }
  329. // CHECK:STDOUT:
  330. // CHECK:STDOUT: specific @UseI(constants.%I.facet.af5) {
  331. // CHECK:STDOUT: %T.loc11_10.1 => constants.%I.facet.af5
  332. // CHECK:STDOUT:
  333. // CHECK:STDOUT: !definition:
  334. // CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type.50b
  335. // CHECK:STDOUT: %I.WithSelf.F.type => constants.%I.WithSelf.F.type.7d2
  336. // CHECK:STDOUT: %.loc11_19.2 => constants.%.623
  337. // CHECK:STDOUT: %I.lookup_impl_witness => constants.%I.impl_witness.ada
  338. // CHECK:STDOUT: %impl.elem0.loc11_19.2 => constants.%T.binding.as_type.as.I.impl.F.ded
  339. // CHECK:STDOUT: %specific_impl_fn.loc11_19.2 => constants.%T.binding.as_type.as.I.impl.F.specific_fn.95b
  340. // CHECK:STDOUT: }
  341. // CHECK:STDOUT:
  342. // CHECK:STDOUT: specific @J.WithSelf(constants.%J.facet) {
  343. // CHECK:STDOUT: !definition:
  344. // CHECK:STDOUT: }
  345. // CHECK:STDOUT:
  346. // CHECK:STDOUT: specific @UseJ(constants.%J.facet) {
  347. // CHECK:STDOUT: %T.loc12_10.1 => constants.%J.facet
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: !definition:
  350. // CHECK:STDOUT: %T.binding.as_type => constants.%C
  351. // CHECK:STDOUT: %.loc12_24.2 => constants.%.d61
  352. // CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness.9a0
  353. // CHECK:STDOUT: %I.facet.loc12_24.2 => constants.%I.facet.2df
  354. // CHECK:STDOUT: %UseI.specific_fn.loc12_18.2 => constants.%UseI.specific_fn.163
  355. // CHECK:STDOUT: }
  356. // CHECK:STDOUT:
  357. // CHECK:STDOUT: specific @T.binding.as_type.as.I.impl(constants.%J.facet) {
  358. // CHECK:STDOUT: %T.loc7_21.1 => constants.%J.facet
  359. // CHECK:STDOUT: %T.binding.as_type => constants.%C
  360. // CHECK:STDOUT: %I.impl_witness.loc7_34.2 => constants.%I.impl_witness.9a0
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: !definition:
  363. // CHECK:STDOUT: %T.binding.as_type.as.I.impl.F.type => constants.%T.binding.as_type.as.I.impl.F.type.9f7
  364. // CHECK:STDOUT: %T.binding.as_type.as.I.impl.F => constants.%T.binding.as_type.as.I.impl.F.698
  365. // CHECK:STDOUT: }
  366. // CHECK:STDOUT:
  367. // CHECK:STDOUT: specific @UseI(constants.%I.facet.2df) {
  368. // CHECK:STDOUT: %T.loc11_10.1 => constants.%I.facet.2df
  369. // CHECK:STDOUT:
  370. // CHECK:STDOUT: !definition:
  371. // CHECK:STDOUT: %T.binding.as_type => constants.%C
  372. // CHECK:STDOUT: %I.WithSelf.F.type => constants.%I.WithSelf.F.type.1b3
  373. // CHECK:STDOUT: %.loc11_19.2 => constants.%.a11
  374. // CHECK:STDOUT: %I.lookup_impl_witness => constants.%I.impl_witness.9a0
  375. // CHECK:STDOUT: %impl.elem0.loc11_19.2 => constants.%T.binding.as_type.as.I.impl.F.698
  376. // CHECK:STDOUT: %specific_impl_fn.loc11_19.2 => constants.%T.binding.as_type.as.I.impl.F.specific_fn.78c
  377. // CHECK:STDOUT: }
  378. // CHECK:STDOUT:
  379. // CHECK:STDOUT: specific @I.WithSelf(constants.%I.facet.2df) {}
  380. // CHECK:STDOUT:
  381. // CHECK:STDOUT: specific @I.WithSelf.F(constants.%I.facet.2df) {}
  382. // CHECK:STDOUT:
  383. // CHECK:STDOUT: specific @T.binding.as_type.as.I.impl.F(constants.%J.facet) {
  384. // CHECK:STDOUT: !definition:
  385. // CHECK:STDOUT: }
  386. // CHECK:STDOUT: