extend_impl_generic.carbon 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  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/int.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/extend_impl_generic.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/extend_impl_generic.carbon
  14. // --- extend_impl_generic_interface.carbon
  15. library "[[@TEST_NAME]]";
  16. interface HasF(T:! type) {
  17. fn F() -> T;
  18. }
  19. class Param {
  20. var x: i32;
  21. }
  22. class C {
  23. extend impl as HasF(Param) {
  24. fn F() -> Param {
  25. return {.x = 2};
  26. }
  27. }
  28. }
  29. fn G(c: C) {
  30. let a: i32 = C.F().x;
  31. var b: i32 = c.F().x;
  32. }
  33. // --- extend_impl_generic_class.carbon
  34. library "[[@TEST_NAME]]";
  35. interface I(T:! type) {
  36. fn F[self: Self](t: T);
  37. }
  38. class X(U:! type) {
  39. extend impl as I(U) {
  40. fn F[self: Self](t: U) { }
  41. }
  42. }
  43. // CHECK:STDOUT: --- extend_impl_generic_interface.carbon
  44. // CHECK:STDOUT:
  45. // CHECK:STDOUT: constants {
  46. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  47. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  48. // CHECK:STDOUT: %T.d9f: type = symbolic_binding T, 0 [symbolic]
  49. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  50. // CHECK:STDOUT: %HasF.type.fe3: type = generic_interface_type @HasF [concrete]
  51. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  52. // CHECK:STDOUT: %HasF.generic: %HasF.type.fe3 = struct_value () [concrete]
  53. // CHECK:STDOUT: %HasF.type.59b: type = facet_type <@HasF, @HasF(%T.d9f)> [symbolic]
  54. // CHECK:STDOUT: %Self.69f: %HasF.type.59b = symbolic_binding Self, 1 [symbolic]
  55. // CHECK:STDOUT: %pattern_type.e6836e.1: type = pattern_type %T.d9f [symbolic]
  56. // CHECK:STDOUT: %HasF.F.type.940: type = fn_type @HasF.F, @HasF(%T.d9f) [symbolic]
  57. // CHECK:STDOUT: %HasF.F.86b: %HasF.F.type.940 = struct_value () [symbolic]
  58. // CHECK:STDOUT: %HasF.assoc_type.1aa: type = assoc_entity_type @HasF, @HasF(%T.d9f) [symbolic]
  59. // CHECK:STDOUT: %assoc0.bd3: %HasF.assoc_type.1aa = assoc_entity element0, @HasF.%HasF.F.decl [symbolic]
  60. // CHECK:STDOUT: %Param: type = class_type @Param [concrete]
  61. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  62. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  63. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  64. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
  65. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  66. // CHECK:STDOUT: %Param.elem: type = unbound_element_type %Param, %i32 [concrete]
  67. // CHECK:STDOUT: %struct_type.x.ed6: type = struct_type {.x: %i32} [concrete]
  68. // CHECK:STDOUT: %complete_type.1ec: <witness> = complete_type_witness %struct_type.x.ed6 [concrete]
  69. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  70. // CHECK:STDOUT: %HasF.type.aca: type = facet_type <@HasF, @HasF(%Param)> [concrete]
  71. // CHECK:STDOUT: %Self.026: %HasF.type.aca = symbolic_binding Self, 1 [symbolic]
  72. // CHECK:STDOUT: %HasF.F.type.7f1: type = fn_type @HasF.F, @HasF(%Param) [concrete]
  73. // CHECK:STDOUT: %HasF.F.eff: %HasF.F.type.7f1 = struct_value () [concrete]
  74. // CHECK:STDOUT: %HasF.assoc_type.257: type = assoc_entity_type @HasF, @HasF(%Param) [concrete]
  75. // CHECK:STDOUT: %assoc0.4e7: %HasF.assoc_type.257 = assoc_entity element0, @HasF.%HasF.F.decl [concrete]
  76. // CHECK:STDOUT: %HasF.impl_witness: <witness> = impl_witness @C.%HasF.impl_witness_table [concrete]
  77. // CHECK:STDOUT: %pattern_type.b01: type = pattern_type %Param [concrete]
  78. // CHECK:STDOUT: %C.as.HasF.impl.F.type: type = fn_type @C.as.HasF.impl.F [concrete]
  79. // CHECK:STDOUT: %C.as.HasF.impl.F: %C.as.HasF.impl.F.type = struct_value () [concrete]
  80. // CHECK:STDOUT: %HasF.facet: %HasF.type.aca = facet_value %C, (%HasF.impl_witness) [concrete]
  81. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  82. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  83. // CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete]
  84. // CHECK:STDOUT: %struct_type.x.c96: type = struct_type {.x: Core.IntLiteral} [concrete]
  85. // CHECK:STDOUT: %struct: %struct_type.x.c96 = struct_value (%int_2.ecc) [concrete]
  86. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  87. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  88. // CHECK:STDOUT: %ImplicitAs.type.d14: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  89. // CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
  90. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  91. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
  92. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51 = struct_value () [symbolic]
  93. // CHECK:STDOUT: %ImplicitAs.impl_witness.bc9: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.132, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  94. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  95. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e = struct_value () [concrete]
  96. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.d14 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.bc9) [concrete]
  97. // CHECK:STDOUT: %.322: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet [concrete]
  98. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b [concrete]
  99. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  100. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  101. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  102. // CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete]
  103. // CHECK:STDOUT: %Param.val: %Param = struct_value (%int_2.ef8) [concrete]
  104. // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete]
  105. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  106. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  107. // CHECK:STDOUT: %.e5e: type = fn_type_with_self_type %HasF.F.type.7f1, %HasF.facet [concrete]
  108. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  109. // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
  110. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.24b: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic]
  111. // CHECK:STDOUT: %Int.as.Copy.impl.Op.c95: %Int.as.Copy.impl.Op.type.24b = struct_value () [symbolic]
  112. // CHECK:STDOUT: %Copy.impl_witness.fb7: <witness> = impl_witness imports.%Copy.impl_witness_table.b6a, @Int.as.Copy.impl(%int_32) [concrete]
  113. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.469: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_32) [concrete]
  114. // CHECK:STDOUT: %Int.as.Copy.impl.Op.dfd: %Int.as.Copy.impl.Op.type.469 = struct_value () [concrete]
  115. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %i32, (%Copy.impl_witness.fb7) [concrete]
  116. // CHECK:STDOUT: %.65f: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete]
  117. // CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %Int.as.Copy.impl.Op.dfd, @Int.as.Copy.impl.Op(%int_32) [concrete]
  118. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  119. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  120. // CHECK:STDOUT: %facet_value.654: %type_where = facet_value %Param, () [concrete]
  121. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.341: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.654) [concrete]
  122. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.2bf: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.341 = struct_value () [concrete]
  123. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.58c: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.2bf, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.654) [concrete]
  124. // CHECK:STDOUT: %facet_value.d23: %type_where = facet_value %i32, () [concrete]
  125. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.d4e: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.d23) [concrete]
  126. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.424: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.d4e = struct_value () [concrete]
  127. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.c20: <specific function> = specific_function %DestroyT.binding.as_type.as.Destroy.impl.Op.424, @DestroyT.binding.as_type.as.Destroy.impl.Op(%facet_value.d23) [concrete]
  128. // CHECK:STDOUT: }
  129. // CHECK:STDOUT:
  130. // CHECK:STDOUT: imports {
  131. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  132. // CHECK:STDOUT: .Int = %Core.Int
  133. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  134. // CHECK:STDOUT: .Copy = %Core.Copy
  135. // CHECK:STDOUT: .Destroy = %Core.Destroy
  136. // CHECK:STDOUT: import Core//prelude
  137. // CHECK:STDOUT: import Core//prelude/...
  138. // CHECK:STDOUT: }
  139. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  140. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  141. // CHECK:STDOUT: %Core.import_ref.e24: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1)]
  142. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.132 = impl_witness_table (%Core.import_ref.e24), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  143. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  144. // CHECK:STDOUT: %Core.import_ref.d12: @Int.as.Copy.impl.%Int.as.Copy.impl.Op.type (%Int.as.Copy.impl.Op.type.24b) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.Copy.impl.%Int.as.Copy.impl.Op (constants.%Int.as.Copy.impl.Op.c95)]
  145. // CHECK:STDOUT: %Copy.impl_witness_table.b6a = impl_witness_table (%Core.import_ref.d12), @Int.as.Copy.impl [concrete]
  146. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  147. // CHECK:STDOUT: }
  148. // CHECK:STDOUT:
  149. // CHECK:STDOUT: file {
  150. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  151. // CHECK:STDOUT: .Core = imports.%Core
  152. // CHECK:STDOUT: .HasF = %HasF.decl
  153. // CHECK:STDOUT: .Param = %Param.decl
  154. // CHECK:STDOUT: .C = %C.decl
  155. // CHECK:STDOUT: .G = %G.decl
  156. // CHECK:STDOUT: }
  157. // CHECK:STDOUT: %Core.import = import Core
  158. // CHECK:STDOUT: %HasF.decl: %HasF.type.fe3 = interface_decl @HasF [concrete = constants.%HasF.generic] {
  159. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  160. // CHECK:STDOUT: } {
  161. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  162. // CHECK:STDOUT: %T.loc4_16.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_16.1 (constants.%T.d9f)]
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT: %Param.decl: type = class_decl @Param [concrete = constants.%Param] {} {}
  165. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  166. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  167. // CHECK:STDOUT: %c.patt: %pattern_type.c48 = value_binding_pattern c [concrete]
  168. // CHECK:STDOUT: %c.param_patt: %pattern_type.c48 = value_param_pattern %c.patt, call_param0 [concrete]
  169. // CHECK:STDOUT: } {
  170. // CHECK:STDOUT: %c.param: %C = value_param call_param0
  171. // CHECK:STDOUT: %C.ref.loc20: type = name_ref C, file.%C.decl [concrete = constants.%C]
  172. // CHECK:STDOUT: %c: %C = value_binding c, %c.param
  173. // CHECK:STDOUT: }
  174. // CHECK:STDOUT: }
  175. // CHECK:STDOUT:
  176. // CHECK:STDOUT: generic interface @HasF(%T.loc4_16.2: type) {
  177. // CHECK:STDOUT: %T.loc4_16.1: type = symbolic_binding T, 0 [symbolic = %T.loc4_16.1 (constants.%T.d9f)]
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: !definition:
  180. // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF, @HasF(%T.loc4_16.1)> [symbolic = %HasF.type (constants.%HasF.type.59b)]
  181. // CHECK:STDOUT: %Self.loc4_26.2: @HasF.%HasF.type (%HasF.type.59b) = symbolic_binding Self, 1 [symbolic = %Self.loc4_26.2 (constants.%Self.69f)]
  182. // CHECK:STDOUT: %HasF.F.type: type = fn_type @HasF.F, @HasF(%T.loc4_16.1) [symbolic = %HasF.F.type (constants.%HasF.F.type.940)]
  183. // CHECK:STDOUT: %HasF.F: @HasF.%HasF.F.type (%HasF.F.type.940) = struct_value () [symbolic = %HasF.F (constants.%HasF.F.86b)]
  184. // CHECK:STDOUT: %HasF.assoc_type: type = assoc_entity_type @HasF, @HasF(%T.loc4_16.1) [symbolic = %HasF.assoc_type (constants.%HasF.assoc_type.1aa)]
  185. // CHECK:STDOUT: %assoc0.loc5_14.2: @HasF.%HasF.assoc_type (%HasF.assoc_type.1aa) = assoc_entity element0, %HasF.F.decl [symbolic = %assoc0.loc5_14.2 (constants.%assoc0.bd3)]
  186. // CHECK:STDOUT:
  187. // CHECK:STDOUT: interface {
  188. // CHECK:STDOUT: %Self.loc4_26.1: @HasF.%HasF.type (%HasF.type.59b) = symbolic_binding Self, 1 [symbolic = %Self.loc4_26.2 (constants.%Self.69f)]
  189. // CHECK:STDOUT: %HasF.F.decl: @HasF.%HasF.F.type (%HasF.F.type.940) = fn_decl @HasF.F [symbolic = @HasF.%HasF.F (constants.%HasF.F.86b)] {
  190. // CHECK:STDOUT: %return.patt: @HasF.F.%pattern_type (%pattern_type.e6836e.1) = return_slot_pattern [concrete]
  191. // CHECK:STDOUT: %return.param_patt: @HasF.F.%pattern_type (%pattern_type.e6836e.1) = out_param_pattern %return.patt, call_param0 [concrete]
  192. // CHECK:STDOUT: } {
  193. // CHECK:STDOUT: %T.ref: type = name_ref T, @HasF.%T.loc4_16.2 [symbolic = %T (constants.%T.d9f)]
  194. // CHECK:STDOUT: %return.param: ref @HasF.F.%T (%T.d9f) = out_param call_param0
  195. // CHECK:STDOUT: %return: ref @HasF.F.%T (%T.d9f) = return_slot %return.param
  196. // CHECK:STDOUT: }
  197. // CHECK:STDOUT: %assoc0.loc5_14.1: @HasF.%HasF.assoc_type (%HasF.assoc_type.1aa) = assoc_entity element0, %HasF.F.decl [symbolic = %assoc0.loc5_14.2 (constants.%assoc0.bd3)]
  198. // CHECK:STDOUT:
  199. // CHECK:STDOUT: !members:
  200. // CHECK:STDOUT: .Self = %Self.loc4_26.1
  201. // CHECK:STDOUT: .T = <poisoned>
  202. // CHECK:STDOUT: .F = %assoc0.loc5_14.1
  203. // CHECK:STDOUT: .Param = <poisoned>
  204. // CHECK:STDOUT: witness = (%HasF.F.decl)
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: !requires:
  207. // CHECK:STDOUT: }
  208. // CHECK:STDOUT: }
  209. // CHECK:STDOUT:
  210. // CHECK:STDOUT: impl @C.as.HasF.impl: %Self.ref as %HasF.type {
  211. // CHECK:STDOUT: %C.as.HasF.impl.F.decl: %C.as.HasF.impl.F.type = fn_decl @C.as.HasF.impl.F [concrete = constants.%C.as.HasF.impl.F] {
  212. // CHECK:STDOUT: %return.patt: %pattern_type.b01 = return_slot_pattern [concrete]
  213. // CHECK:STDOUT: %return.param_patt: %pattern_type.b01 = out_param_pattern %return.patt, call_param0 [concrete]
  214. // CHECK:STDOUT: } {
  215. // CHECK:STDOUT: %Param.ref: type = name_ref Param, file.%Param.decl [concrete = constants.%Param]
  216. // CHECK:STDOUT: %return.param: ref %Param = out_param call_param0
  217. // CHECK:STDOUT: %return: ref %Param = return_slot %return.param
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: !members:
  221. // CHECK:STDOUT: .Param = <poisoned>
  222. // CHECK:STDOUT: .F = %C.as.HasF.impl.F.decl
  223. // CHECK:STDOUT: witness = @C.%HasF.impl_witness
  224. // CHECK:STDOUT: }
  225. // CHECK:STDOUT:
  226. // CHECK:STDOUT: class @Param {
  227. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  228. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  229. // CHECK:STDOUT: %.loc9: %Param.elem = field_decl x, element0 [concrete]
  230. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.x.ed6 [concrete = constants.%complete_type.1ec]
  231. // CHECK:STDOUT: complete_type_witness = %complete_type
  232. // CHECK:STDOUT:
  233. // CHECK:STDOUT: !members:
  234. // CHECK:STDOUT: .Self = constants.%Param
  235. // CHECK:STDOUT: .x = %.loc9
  236. // CHECK:STDOUT: }
  237. // CHECK:STDOUT:
  238. // CHECK:STDOUT: class @C {
  239. // CHECK:STDOUT: impl_decl @C.as.HasF.impl [concrete] {} {
  240. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [concrete = constants.%C]
  241. // CHECK:STDOUT: %HasF.ref: %HasF.type.fe3 = name_ref HasF, file.%HasF.decl [concrete = constants.%HasF.generic]
  242. // CHECK:STDOUT: %Param.ref: type = name_ref Param, file.%Param.decl [concrete = constants.%Param]
  243. // CHECK:STDOUT: %HasF.type: type = facet_type <@HasF, @HasF(constants.%Param)> [concrete = constants.%HasF.type.aca]
  244. // CHECK:STDOUT: }
  245. // CHECK:STDOUT: %HasF.impl_witness_table = impl_witness_table (@C.as.HasF.impl.%C.as.HasF.impl.F.decl), @C.as.HasF.impl [concrete]
  246. // CHECK:STDOUT: %HasF.impl_witness: <witness> = impl_witness %HasF.impl_witness_table [concrete = constants.%HasF.impl_witness]
  247. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type.357]
  248. // CHECK:STDOUT: complete_type_witness = %complete_type
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: !members:
  251. // CHECK:STDOUT: .Self = constants.%C
  252. // CHECK:STDOUT: .HasF = <poisoned>
  253. // CHECK:STDOUT: .Param = <poisoned>
  254. // CHECK:STDOUT: .F = <poisoned>
  255. // CHECK:STDOUT: extend @C.as.HasF.impl.%HasF.type
  256. // CHECK:STDOUT: }
  257. // CHECK:STDOUT:
  258. // CHECK:STDOUT: generic fn @HasF.F(@HasF.%T.loc4_16.2: type, @HasF.%Self.loc4_26.1: @HasF.%HasF.type (%HasF.type.59b)) {
  259. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T.d9f)]
  260. // CHECK:STDOUT: %pattern_type: type = pattern_type %T [symbolic = %pattern_type (constants.%pattern_type.e6836e.1)]
  261. // CHECK:STDOUT:
  262. // CHECK:STDOUT: fn() -> @HasF.F.%T (%T.d9f);
  263. // CHECK:STDOUT: }
  264. // CHECK:STDOUT:
  265. // CHECK:STDOUT: fn @C.as.HasF.impl.F() -> %return.param: %Param {
  266. // CHECK:STDOUT: !entry:
  267. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
  268. // CHECK:STDOUT: %.loc15_21.1: %struct_type.x.c96 = struct_literal (%int_2) [concrete = constants.%struct]
  269. // CHECK:STDOUT: %impl.elem0: %.322 = impl_witness_access constants.%ImplicitAs.impl_witness.bc9, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b]
  270. // CHECK:STDOUT: %bound_method.loc15_21.1: <bound method> = bound_method %int_2, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
  271. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  272. // CHECK:STDOUT: %bound_method.loc15_21.2: <bound method> = bound_method %int_2, %specific_fn [concrete = constants.%bound_method]
  273. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc15_21.2(%int_2) [concrete = constants.%int_2.ef8]
  274. // CHECK:STDOUT: %.loc15_21.2: init %i32 = converted %int_2, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_2.ef8]
  275. // CHECK:STDOUT: %.loc15_21.3: ref %i32 = class_element_access %return, element0
  276. // CHECK:STDOUT: %.loc15_21.4: init %i32 = initialize_from %.loc15_21.2 to %.loc15_21.3 [concrete = constants.%int_2.ef8]
  277. // CHECK:STDOUT: %.loc15_21.5: init %Param = class_init (%.loc15_21.4), %return [concrete = constants.%Param.val]
  278. // CHECK:STDOUT: %.loc15_22: init %Param = converted %.loc15_21.1, %.loc15_21.5 [concrete = constants.%Param.val]
  279. // CHECK:STDOUT: return %.loc15_22 to %return
  280. // CHECK:STDOUT: }
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: fn @G(%c.param: %C) {
  283. // CHECK:STDOUT: !entry:
  284. // CHECK:STDOUT: name_binding_decl {
  285. // CHECK:STDOUT: %a.patt: %pattern_type.7ce = value_binding_pattern a [concrete]
  286. // CHECK:STDOUT: }
  287. // CHECK:STDOUT: %C.ref.loc21: type = name_ref C, file.%C.decl [concrete = constants.%C]
  288. // CHECK:STDOUT: %.loc21_17: %HasF.assoc_type.257 = specific_constant @HasF.%assoc0.loc5_14.1, @HasF(constants.%Param) [concrete = constants.%assoc0.4e7]
  289. // CHECK:STDOUT: %F.ref.loc21: %HasF.assoc_type.257 = name_ref F, %.loc21_17 [concrete = constants.%assoc0.4e7]
  290. // CHECK:STDOUT: %impl.elem0.loc21: %.e5e = impl_witness_access constants.%HasF.impl_witness, element0 [concrete = constants.%C.as.HasF.impl.F]
  291. // CHECK:STDOUT: %.loc21_20.1: ref %Param = temporary_storage
  292. // CHECK:STDOUT: %C.as.HasF.impl.F.call.loc21: init %Param = call %impl.elem0.loc21() to %.loc21_20.1
  293. // CHECK:STDOUT: %.loc21_20.2: ref %Param = temporary %.loc21_20.1, %C.as.HasF.impl.F.call.loc21
  294. // CHECK:STDOUT: %x.ref.loc21: %Param.elem = name_ref x, @Param.%.loc9 [concrete = @Param.%.loc9]
  295. // CHECK:STDOUT: %.loc21_21.1: ref %i32 = class_element_access %.loc21_20.2, element0
  296. // CHECK:STDOUT: %.loc21_10: type = splice_block %i32.loc21 [concrete = constants.%i32] {
  297. // CHECK:STDOUT: %int_32.loc21: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  298. // CHECK:STDOUT: %i32.loc21: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  299. // CHECK:STDOUT: }
  300. // CHECK:STDOUT: %.loc21_21.2: %i32 = acquire_value %.loc21_21.1
  301. // CHECK:STDOUT: %a: %i32 = value_binding a, %.loc21_21.2
  302. // CHECK:STDOUT: name_binding_decl {
  303. // CHECK:STDOUT: %b.patt: %pattern_type.7ce = ref_binding_pattern b [concrete]
  304. // CHECK:STDOUT: %b.var_patt: %pattern_type.7ce = var_pattern %b.patt [concrete]
  305. // CHECK:STDOUT: }
  306. // CHECK:STDOUT: %b.var: ref %i32 = var %b.var_patt
  307. // CHECK:STDOUT: %c.ref: %C = name_ref c, %c
  308. // CHECK:STDOUT: %.loc22_17: %HasF.assoc_type.257 = specific_constant @HasF.%assoc0.loc5_14.1, @HasF(constants.%Param) [concrete = constants.%assoc0.4e7]
  309. // CHECK:STDOUT: %F.ref.loc22: %HasF.assoc_type.257 = name_ref F, %.loc22_17 [concrete = constants.%assoc0.4e7]
  310. // CHECK:STDOUT: %impl.elem0.loc22_17: %.e5e = impl_witness_access constants.%HasF.impl_witness, element0 [concrete = constants.%C.as.HasF.impl.F]
  311. // CHECK:STDOUT: %.loc22_20.1: ref %Param = temporary_storage
  312. // CHECK:STDOUT: %C.as.HasF.impl.F.call.loc22: init %Param = call %impl.elem0.loc22_17() to %.loc22_20.1
  313. // CHECK:STDOUT: %.loc22_20.2: ref %Param = temporary %.loc22_20.1, %C.as.HasF.impl.F.call.loc22
  314. // CHECK:STDOUT: %x.ref.loc22: %Param.elem = name_ref x, @Param.%.loc9 [concrete = @Param.%.loc9]
  315. // CHECK:STDOUT: %.loc22_21.1: ref %i32 = class_element_access %.loc22_20.2, element0
  316. // CHECK:STDOUT: %.loc22_21.2: %i32 = acquire_value %.loc22_21.1
  317. // CHECK:STDOUT: %impl.elem0.loc22_21: %.65f = impl_witness_access constants.%Copy.impl_witness.fb7, element0 [concrete = constants.%Int.as.Copy.impl.Op.dfd]
  318. // CHECK:STDOUT: %bound_method.loc22_21.1: <bound method> = bound_method %.loc22_21.2, %impl.elem0.loc22_21
  319. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0.loc22_21, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  320. // CHECK:STDOUT: %bound_method.loc22_21.2: <bound method> = bound_method %.loc22_21.2, %specific_fn
  321. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc22_21.2(%.loc22_21.2)
  322. // CHECK:STDOUT: assign %b.var, %Int.as.Copy.impl.Op.call
  323. // CHECK:STDOUT: %.loc22_10: type = splice_block %i32.loc22 [concrete = constants.%i32] {
  324. // CHECK:STDOUT: %int_32.loc22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  325. // CHECK:STDOUT: %i32.loc22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  326. // CHECK:STDOUT: }
  327. // CHECK:STDOUT: %b: ref %i32 = ref_binding b, %b.var
  328. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc22_20: <bound method> = bound_method %.loc22_20.2, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.2bf
  329. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1: <specific function> = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.2bf, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value.654) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.58c]
  330. // CHECK:STDOUT: %bound_method.loc22_20: <bound method> = bound_method %.loc22_20.2, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1
  331. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc22_20: init %empty_tuple.type = call %bound_method.loc22_20(%.loc22_20.2)
  332. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc22_3: <bound method> = bound_method %b.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.424
  333. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2: <specific function> = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.424, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value.d23) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.c20]
  334. // CHECK:STDOUT: %bound_method.loc22_3: <bound method> = bound_method %b.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2
  335. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc22_3: init %empty_tuple.type = call %bound_method.loc22_3(%b.var)
  336. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc21: <bound method> = bound_method %.loc21_20.2, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.2bf
  337. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.3: <specific function> = specific_function constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.2bf, @DestroyT.binding.as_type.as.Destroy.impl.Op(constants.%facet_value.654) [concrete = constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.58c]
  338. // CHECK:STDOUT: %bound_method.loc21: <bound method> = bound_method %.loc21_20.2, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.3
  339. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc21: init %empty_tuple.type = call %bound_method.loc21(%.loc21_20.2)
  340. // CHECK:STDOUT: return
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT:
  343. // CHECK:STDOUT: specific @HasF(constants.%T.d9f) {
  344. // CHECK:STDOUT: %T.loc4_16.1 => constants.%T.d9f
  345. // CHECK:STDOUT: }
  346. // CHECK:STDOUT:
  347. // CHECK:STDOUT: specific @HasF.F(constants.%T.d9f, constants.%Self.69f) {
  348. // CHECK:STDOUT: %T => constants.%T.d9f
  349. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.e6836e.1
  350. // CHECK:STDOUT: }
  351. // CHECK:STDOUT:
  352. // CHECK:STDOUT: specific @HasF(constants.%Param) {
  353. // CHECK:STDOUT: %T.loc4_16.1 => constants.%Param
  354. // CHECK:STDOUT:
  355. // CHECK:STDOUT: !definition:
  356. // CHECK:STDOUT: %HasF.type => constants.%HasF.type.aca
  357. // CHECK:STDOUT: %Self.loc4_26.2 => constants.%Self.026
  358. // CHECK:STDOUT: %HasF.F.type => constants.%HasF.F.type.7f1
  359. // CHECK:STDOUT: %HasF.F => constants.%HasF.F.eff
  360. // CHECK:STDOUT: %HasF.assoc_type => constants.%HasF.assoc_type.257
  361. // CHECK:STDOUT: %assoc0.loc5_14.2 => constants.%assoc0.4e7
  362. // CHECK:STDOUT: }
  363. // CHECK:STDOUT:
  364. // CHECK:STDOUT: specific @HasF.F(constants.%Param, constants.%HasF.facet) {
  365. // CHECK:STDOUT: %T => constants.%Param
  366. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.b01
  367. // CHECK:STDOUT: }
  368. // CHECK:STDOUT:
  369. // CHECK:STDOUT: --- extend_impl_generic_class.carbon
  370. // CHECK:STDOUT:
  371. // CHECK:STDOUT: constants {
  372. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  373. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  374. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  375. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  376. // CHECK:STDOUT: %I.type.dac: type = generic_interface_type @I [concrete]
  377. // CHECK:STDOUT: %I.generic: %I.type.dac = struct_value () [concrete]
  378. // CHECK:STDOUT: %I.type.07036d.1: type = facet_type <@I, @I(%T)> [symbolic]
  379. // CHECK:STDOUT: %Self.2694d8.1: %I.type.07036d.1 = symbolic_binding Self, 1 [symbolic]
  380. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self.2694d8.1 [symbolic]
  381. // CHECK:STDOUT: %pattern_type.dbc: type = pattern_type %Self.binding.as_type [symbolic]
  382. // CHECK:STDOUT: %pattern_type.e6836e.1: type = pattern_type %T [symbolic]
  383. // CHECK:STDOUT: %I.F.type.76d346.1: type = fn_type @I.F, @I(%T) [symbolic]
  384. // CHECK:STDOUT: %I.F.dde9b0.1: %I.F.type.76d346.1 = struct_value () [symbolic]
  385. // CHECK:STDOUT: %I.assoc_type.b650b2.1: type = assoc_entity_type @I, @I(%T) [symbolic]
  386. // CHECK:STDOUT: %assoc0.b4fda0.1: %I.assoc_type.b650b2.1 = assoc_entity element0, @I.%I.F.decl [symbolic]
  387. // CHECK:STDOUT: %U: type = symbolic_binding U, 0 [symbolic]
  388. // CHECK:STDOUT: %X.type: type = generic_class_type @X [concrete]
  389. // CHECK:STDOUT: %X.generic: %X.type = struct_value () [concrete]
  390. // CHECK:STDOUT: %X: type = class_type @X, @X(%U) [symbolic]
  391. // CHECK:STDOUT: %I.type.07036d.2: type = facet_type <@I, @I(%U)> [symbolic]
  392. // CHECK:STDOUT: %Self.2694d8.2: %I.type.07036d.2 = symbolic_binding Self, 1 [symbolic]
  393. // CHECK:STDOUT: %I.F.type.76d346.2: type = fn_type @I.F, @I(%U) [symbolic]
  394. // CHECK:STDOUT: %I.F.dde9b0.2: %I.F.type.76d346.2 = struct_value () [symbolic]
  395. // CHECK:STDOUT: %I.assoc_type.b650b2.2: type = assoc_entity_type @I, @I(%U) [symbolic]
  396. // CHECK:STDOUT: %assoc0.b4fda0.2: %I.assoc_type.b650b2.2 = assoc_entity element0, @I.%I.F.decl [symbolic]
  397. // CHECK:STDOUT: %require_complete.c94: <witness> = require_complete_type %I.type.07036d.2 [symbolic]
  398. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness @X.%I.impl_witness_table, @X.as.I.impl(%U) [symbolic]
  399. // CHECK:STDOUT: %pattern_type.def: type = pattern_type %X [symbolic]
  400. // CHECK:STDOUT: %pattern_type.e6836e.2: type = pattern_type %U [symbolic]
  401. // CHECK:STDOUT: %X.as.I.impl.F.type: type = fn_type @X.as.I.impl.F, @X.as.I.impl(%U) [symbolic]
  402. // CHECK:STDOUT: %X.as.I.impl.F: %X.as.I.impl.F.type = struct_value () [symbolic]
  403. // CHECK:STDOUT: %I.facet: %I.type.07036d.2 = facet_value %X, (%I.impl_witness) [symbolic]
  404. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  405. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  406. // CHECK:STDOUT: %require_complete.6fb: <witness> = require_complete_type %X [symbolic]
  407. // CHECK:STDOUT: %require_complete.4b7: <witness> = require_complete_type %U [symbolic]
  408. // CHECK:STDOUT: }
  409. // CHECK:STDOUT:
  410. // CHECK:STDOUT: imports {
  411. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  412. // CHECK:STDOUT: import Core//prelude
  413. // CHECK:STDOUT: import Core//prelude/...
  414. // CHECK:STDOUT: }
  415. // CHECK:STDOUT: }
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: file {
  418. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  419. // CHECK:STDOUT: .Core = imports.%Core
  420. // CHECK:STDOUT: .I = %I.decl
  421. // CHECK:STDOUT: .X = %X.decl
  422. // CHECK:STDOUT: }
  423. // CHECK:STDOUT: %Core.import = import Core
  424. // CHECK:STDOUT: %I.decl: %I.type.dac = interface_decl @I [concrete = constants.%I.generic] {
  425. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  426. // CHECK:STDOUT: } {
  427. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  428. // CHECK:STDOUT: %T.loc4_13.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_13.1 (constants.%T)]
  429. // CHECK:STDOUT: }
  430. // CHECK:STDOUT: %X.decl: %X.type = class_decl @X [concrete = constants.%X.generic] {
  431. // CHECK:STDOUT: %U.patt: %pattern_type.98f = symbolic_binding_pattern U, 0 [concrete]
  432. // CHECK:STDOUT: } {
  433. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  434. // CHECK:STDOUT: %U.loc8_9.2: type = symbolic_binding U, 0 [symbolic = %U.loc8_9.1 (constants.%U)]
  435. // CHECK:STDOUT: }
  436. // CHECK:STDOUT: }
  437. // CHECK:STDOUT:
  438. // CHECK:STDOUT: generic interface @I(%T.loc4_13.2: type) {
  439. // CHECK:STDOUT: %T.loc4_13.1: type = symbolic_binding T, 0 [symbolic = %T.loc4_13.1 (constants.%T)]
  440. // CHECK:STDOUT:
  441. // CHECK:STDOUT: !definition:
  442. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T.loc4_13.1)> [symbolic = %I.type (constants.%I.type.07036d.1)]
  443. // CHECK:STDOUT: %Self.loc4_23.2: @I.%I.type (%I.type.07036d.1) = symbolic_binding Self, 1 [symbolic = %Self.loc4_23.2 (constants.%Self.2694d8.1)]
  444. // CHECK:STDOUT: %I.F.type: type = fn_type @I.F, @I(%T.loc4_13.1) [symbolic = %I.F.type (constants.%I.F.type.76d346.1)]
  445. // CHECK:STDOUT: %I.F: @I.%I.F.type (%I.F.type.76d346.1) = struct_value () [symbolic = %I.F (constants.%I.F.dde9b0.1)]
  446. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I, @I(%T.loc4_13.1) [symbolic = %I.assoc_type (constants.%I.assoc_type.b650b2.1)]
  447. // CHECK:STDOUT: %assoc0.loc5_25.2: @I.%I.assoc_type (%I.assoc_type.b650b2.1) = assoc_entity element0, %I.F.decl [symbolic = %assoc0.loc5_25.2 (constants.%assoc0.b4fda0.1)]
  448. // CHECK:STDOUT:
  449. // CHECK:STDOUT: interface {
  450. // CHECK:STDOUT: %Self.loc4_23.1: @I.%I.type (%I.type.07036d.1) = symbolic_binding Self, 1 [symbolic = %Self.loc4_23.2 (constants.%Self.2694d8.1)]
  451. // CHECK:STDOUT: %I.F.decl: @I.%I.F.type (%I.F.type.76d346.1) = fn_decl @I.F [symbolic = @I.%I.F (constants.%I.F.dde9b0.1)] {
  452. // CHECK:STDOUT: %self.patt: @I.F.%pattern_type.loc5_8 (%pattern_type.dbc) = value_binding_pattern self [concrete]
  453. // CHECK:STDOUT: %self.param_patt: @I.F.%pattern_type.loc5_8 (%pattern_type.dbc) = value_param_pattern %self.patt, call_param0 [concrete]
  454. // CHECK:STDOUT: %t.patt: @I.F.%pattern_type.loc5_20 (%pattern_type.e6836e.1) = value_binding_pattern t [concrete]
  455. // CHECK:STDOUT: %t.param_patt: @I.F.%pattern_type.loc5_20 (%pattern_type.e6836e.1) = value_param_pattern %t.patt, call_param1 [concrete]
  456. // CHECK:STDOUT: } {
  457. // CHECK:STDOUT: %self.param: @I.F.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0
  458. // CHECK:STDOUT: %.loc5_14.1: type = splice_block %.loc5_14.3 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] {
  459. // CHECK:STDOUT: %.loc5_14.2: @I.F.%I.type (%I.type.07036d.1) = specific_constant @I.%Self.loc4_23.1, @I(constants.%T) [symbolic = %Self (constants.%Self.2694d8.1)]
  460. // CHECK:STDOUT: %Self.ref: @I.F.%I.type (%I.type.07036d.1) = name_ref Self, %.loc5_14.2 [symbolic = %Self (constants.%Self.2694d8.1)]
  461. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  462. // CHECK:STDOUT: %.loc5_14.3: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  463. // CHECK:STDOUT: }
  464. // CHECK:STDOUT: %self: @I.F.%Self.binding.as_type (%Self.binding.as_type) = value_binding self, %self.param
  465. // CHECK:STDOUT: %t.param: @I.F.%T (%T) = value_param call_param1
  466. // CHECK:STDOUT: %T.ref: type = name_ref T, @I.%T.loc4_13.2 [symbolic = %T (constants.%T)]
  467. // CHECK:STDOUT: %t: @I.F.%T (%T) = value_binding t, %t.param
  468. // CHECK:STDOUT: }
  469. // CHECK:STDOUT: %assoc0.loc5_25.1: @I.%I.assoc_type (%I.assoc_type.b650b2.1) = assoc_entity element0, %I.F.decl [symbolic = %assoc0.loc5_25.2 (constants.%assoc0.b4fda0.1)]
  470. // CHECK:STDOUT:
  471. // CHECK:STDOUT: !members:
  472. // CHECK:STDOUT: .Self = %Self.loc4_23.1
  473. // CHECK:STDOUT: .T = <poisoned>
  474. // CHECK:STDOUT: .F = %assoc0.loc5_25.1
  475. // CHECK:STDOUT: .U = <poisoned>
  476. // CHECK:STDOUT: witness = (%I.F.decl)
  477. // CHECK:STDOUT:
  478. // CHECK:STDOUT: !requires:
  479. // CHECK:STDOUT: }
  480. // CHECK:STDOUT: }
  481. // CHECK:STDOUT:
  482. // CHECK:STDOUT: generic impl @X.as.I.impl(@X.%U.loc8_9.2: type) {
  483. // CHECK:STDOUT: %U: type = symbolic_binding U, 0 [symbolic = %U (constants.%U)]
  484. // CHECK:STDOUT: %X: type = class_type @X, @X(%U) [symbolic = %X (constants.%X)]
  485. // CHECK:STDOUT: %I.type.loc9_21.1: type = facet_type <@I, @I(%U)> [symbolic = %I.type.loc9_21.1 (constants.%I.type.07036d.2)]
  486. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %I.type.loc9_21.1 [symbolic = %require_complete (constants.%require_complete.c94)]
  487. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness @X.%I.impl_witness_table, @X.as.I.impl(%U) [symbolic = %I.impl_witness (constants.%I.impl_witness)]
  488. // CHECK:STDOUT:
  489. // CHECK:STDOUT: !definition:
  490. // CHECK:STDOUT: %X.as.I.impl.F.type: type = fn_type @X.as.I.impl.F, @X.as.I.impl(%U) [symbolic = %X.as.I.impl.F.type (constants.%X.as.I.impl.F.type)]
  491. // CHECK:STDOUT: %X.as.I.impl.F: @X.as.I.impl.%X.as.I.impl.F.type (%X.as.I.impl.F.type) = struct_value () [symbolic = %X.as.I.impl.F (constants.%X.as.I.impl.F)]
  492. // CHECK:STDOUT:
  493. // CHECK:STDOUT: impl: %Self.ref as %I.type.loc9_21.2 {
  494. // CHECK:STDOUT: %X.as.I.impl.F.decl: @X.as.I.impl.%X.as.I.impl.F.type (%X.as.I.impl.F.type) = fn_decl @X.as.I.impl.F [symbolic = @X.as.I.impl.%X.as.I.impl.F (constants.%X.as.I.impl.F)] {
  495. // CHECK:STDOUT: %self.patt: @X.as.I.impl.F.%pattern_type.loc10_10 (%pattern_type.def) = value_binding_pattern self [concrete]
  496. // CHECK:STDOUT: %self.param_patt: @X.as.I.impl.F.%pattern_type.loc10_10 (%pattern_type.def) = value_param_pattern %self.patt, call_param0 [concrete]
  497. // CHECK:STDOUT: %t.patt: @X.as.I.impl.F.%pattern_type.loc10_22 (%pattern_type.e6836e.2) = value_binding_pattern t [concrete]
  498. // CHECK:STDOUT: %t.param_patt: @X.as.I.impl.F.%pattern_type.loc10_22 (%pattern_type.e6836e.2) = value_param_pattern %t.patt, call_param1 [concrete]
  499. // CHECK:STDOUT: } {
  500. // CHECK:STDOUT: %self.param: @X.as.I.impl.F.%X (%X) = value_param call_param0
  501. // CHECK:STDOUT: %.loc10_16.1: type = splice_block %Self.ref [symbolic = %X (constants.%X)] {
  502. // CHECK:STDOUT: %.loc10_16.2: type = specific_constant constants.%X, @X(constants.%U) [symbolic = %X (constants.%X)]
  503. // CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc10_16.2 [symbolic = %X (constants.%X)]
  504. // CHECK:STDOUT: }
  505. // CHECK:STDOUT: %self: @X.as.I.impl.F.%X (%X) = value_binding self, %self.param
  506. // CHECK:STDOUT: %t.param: @X.as.I.impl.F.%U (%U) = value_param call_param1
  507. // CHECK:STDOUT: %U.ref: type = name_ref U, @X.%U.loc8_9.2 [symbolic = %U (constants.%U)]
  508. // CHECK:STDOUT: %t: @X.as.I.impl.F.%U (%U) = value_binding t, %t.param
  509. // CHECK:STDOUT: }
  510. // CHECK:STDOUT:
  511. // CHECK:STDOUT: !members:
  512. // CHECK:STDOUT: .U = <poisoned>
  513. // CHECK:STDOUT: .F = %X.as.I.impl.F.decl
  514. // CHECK:STDOUT: witness = @X.%I.impl_witness
  515. // CHECK:STDOUT: }
  516. // CHECK:STDOUT: }
  517. // CHECK:STDOUT:
  518. // CHECK:STDOUT: generic class @X(%U.loc8_9.2: type) {
  519. // CHECK:STDOUT: %U.loc8_9.1: type = symbolic_binding U, 0 [symbolic = %U.loc8_9.1 (constants.%U)]
  520. // CHECK:STDOUT:
  521. // CHECK:STDOUT: !definition:
  522. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%U.loc8_9.1)> [symbolic = %I.type (constants.%I.type.07036d.2)]
  523. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %I.type [symbolic = %require_complete (constants.%require_complete.c94)]
  524. // CHECK:STDOUT:
  525. // CHECK:STDOUT: class {
  526. // CHECK:STDOUT: impl_decl @X.as.I.impl [concrete] {} {
  527. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%X [symbolic = %X (constants.%X)]
  528. // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, file.%I.decl [concrete = constants.%I.generic]
  529. // CHECK:STDOUT: %U.ref: type = name_ref U, @X.%U.loc8_9.2 [symbolic = %U (constants.%U)]
  530. // CHECK:STDOUT: %I.type.loc9_21.2: type = facet_type <@I, @I(constants.%U)> [symbolic = %I.type.loc9_21.1 (constants.%I.type.07036d.2)]
  531. // CHECK:STDOUT: }
  532. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (@X.as.I.impl.%X.as.I.impl.F.decl), @X.as.I.impl [concrete]
  533. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table, @X.as.I.impl(constants.%U) [symbolic = @X.as.I.impl.%I.impl_witness (constants.%I.impl_witness)]
  534. // CHECK:STDOUT: %.loc9: type = specific_constant @X.as.I.impl.%I.type.loc9_21.2, @X.as.I.impl(constants.%U) [symbolic = %I.type (constants.%I.type.07036d.2)]
  535. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  536. // CHECK:STDOUT: complete_type_witness = %complete_type
  537. // CHECK:STDOUT:
  538. // CHECK:STDOUT: !members:
  539. // CHECK:STDOUT: .Self = constants.%X
  540. // CHECK:STDOUT: .I = <poisoned>
  541. // CHECK:STDOUT: .U = <poisoned>
  542. // CHECK:STDOUT: extend %.loc9
  543. // CHECK:STDOUT: }
  544. // CHECK:STDOUT: }
  545. // CHECK:STDOUT:
  546. // CHECK:STDOUT: generic fn @I.F(@I.%T.loc4_13.2: type, @I.%Self.loc4_23.1: @I.%I.type (%I.type.07036d.1)) {
  547. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)]
  548. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.07036d.1)]
  549. // CHECK:STDOUT: %Self: @I.F.%I.type (%I.type.07036d.1) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self.2694d8.1)]
  550. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  551. // CHECK:STDOUT: %pattern_type.loc5_8: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type.loc5_8 (constants.%pattern_type.dbc)]
  552. // CHECK:STDOUT: %pattern_type.loc5_20: type = pattern_type %T [symbolic = %pattern_type.loc5_20 (constants.%pattern_type.e6836e.1)]
  553. // CHECK:STDOUT:
  554. // CHECK:STDOUT: fn(%self.param: @I.F.%Self.binding.as_type (%Self.binding.as_type), %t.param: @I.F.%T (%T));
  555. // CHECK:STDOUT: }
  556. // CHECK:STDOUT:
  557. // CHECK:STDOUT: generic fn @X.as.I.impl.F(@X.%U.loc8_9.2: type) {
  558. // CHECK:STDOUT: %U: type = symbolic_binding U, 0 [symbolic = %U (constants.%U)]
  559. // CHECK:STDOUT: %X: type = class_type @X, @X(%U) [symbolic = %X (constants.%X)]
  560. // CHECK:STDOUT: %pattern_type.loc10_10: type = pattern_type %X [symbolic = %pattern_type.loc10_10 (constants.%pattern_type.def)]
  561. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%U)> [symbolic = %I.type (constants.%I.type.07036d.2)]
  562. // CHECK:STDOUT: %require_complete.loc10_25: <witness> = require_complete_type %I.type [symbolic = %require_complete.loc10_25 (constants.%require_complete.c94)]
  563. // CHECK:STDOUT: %pattern_type.loc10_22: type = pattern_type %U [symbolic = %pattern_type.loc10_22 (constants.%pattern_type.e6836e.2)]
  564. // CHECK:STDOUT:
  565. // CHECK:STDOUT: !definition:
  566. // CHECK:STDOUT: %require_complete.loc10_14: <witness> = require_complete_type %X [symbolic = %require_complete.loc10_14 (constants.%require_complete.6fb)]
  567. // CHECK:STDOUT: %require_complete.loc10_23: <witness> = require_complete_type %U [symbolic = %require_complete.loc10_23 (constants.%require_complete.4b7)]
  568. // CHECK:STDOUT:
  569. // CHECK:STDOUT: fn(%self.param: @X.as.I.impl.F.%X (%X), %t.param: @X.as.I.impl.F.%U (%U)) {
  570. // CHECK:STDOUT: !entry:
  571. // CHECK:STDOUT: return
  572. // CHECK:STDOUT: }
  573. // CHECK:STDOUT: }
  574. // CHECK:STDOUT:
  575. // CHECK:STDOUT: specific @I(constants.%T) {
  576. // CHECK:STDOUT: %T.loc4_13.1 => constants.%T
  577. // CHECK:STDOUT: }
  578. // CHECK:STDOUT:
  579. // CHECK:STDOUT: specific @I.F(constants.%T, constants.%Self.2694d8.1) {
  580. // CHECK:STDOUT: %T => constants.%T
  581. // CHECK:STDOUT: %I.type => constants.%I.type.07036d.1
  582. // CHECK:STDOUT: %Self => constants.%Self.2694d8.1
  583. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  584. // CHECK:STDOUT: %pattern_type.loc5_8 => constants.%pattern_type.dbc
  585. // CHECK:STDOUT: %pattern_type.loc5_20 => constants.%pattern_type.e6836e.1
  586. // CHECK:STDOUT: }
  587. // CHECK:STDOUT:
  588. // CHECK:STDOUT: specific @X(constants.%U) {
  589. // CHECK:STDOUT: %U.loc8_9.1 => constants.%U
  590. // CHECK:STDOUT:
  591. // CHECK:STDOUT: !definition:
  592. // CHECK:STDOUT: %I.type => constants.%I.type.07036d.2
  593. // CHECK:STDOUT: %require_complete => constants.%require_complete.c94
  594. // CHECK:STDOUT: }
  595. // CHECK:STDOUT:
  596. // CHECK:STDOUT: specific @I(constants.%U) {
  597. // CHECK:STDOUT: %T.loc4_13.1 => constants.%U
  598. // CHECK:STDOUT:
  599. // CHECK:STDOUT: !definition:
  600. // CHECK:STDOUT: %I.type => constants.%I.type.07036d.2
  601. // CHECK:STDOUT: %Self.loc4_23.2 => constants.%Self.2694d8.2
  602. // CHECK:STDOUT: %I.F.type => constants.%I.F.type.76d346.2
  603. // CHECK:STDOUT: %I.F => constants.%I.F.dde9b0.2
  604. // CHECK:STDOUT: %I.assoc_type => constants.%I.assoc_type.b650b2.2
  605. // CHECK:STDOUT: %assoc0.loc5_25.2 => constants.%assoc0.b4fda0.2
  606. // CHECK:STDOUT: }
  607. // CHECK:STDOUT:
  608. // CHECK:STDOUT: specific @X.as.I.impl(constants.%U) {
  609. // CHECK:STDOUT: %U => constants.%U
  610. // CHECK:STDOUT: %X => constants.%X
  611. // CHECK:STDOUT: %I.type.loc9_21.1 => constants.%I.type.07036d.2
  612. // CHECK:STDOUT: %require_complete => constants.%require_complete.c94
  613. // CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness
  614. // CHECK:STDOUT:
  615. // CHECK:STDOUT: !definition:
  616. // CHECK:STDOUT: %X.as.I.impl.F.type => constants.%X.as.I.impl.F.type
  617. // CHECK:STDOUT: %X.as.I.impl.F => constants.%X.as.I.impl.F
  618. // CHECK:STDOUT: }
  619. // CHECK:STDOUT:
  620. // CHECK:STDOUT: specific @X.as.I.impl.F(constants.%U) {
  621. // CHECK:STDOUT: %U => constants.%U
  622. // CHECK:STDOUT: %X => constants.%X
  623. // CHECK:STDOUT: %pattern_type.loc10_10 => constants.%pattern_type.def
  624. // CHECK:STDOUT: %I.type => constants.%I.type.07036d.2
  625. // CHECK:STDOUT: %require_complete.loc10_25 => constants.%require_complete.c94
  626. // CHECK:STDOUT: %pattern_type.loc10_22 => constants.%pattern_type.e6836e.2
  627. // CHECK:STDOUT: }
  628. // CHECK:STDOUT:
  629. // CHECK:STDOUT: specific @I.F(constants.%U, constants.%I.facet) {
  630. // CHECK:STDOUT: %T => constants.%U
  631. // CHECK:STDOUT: %I.type => constants.%I.type.07036d.2
  632. // CHECK:STDOUT: %Self => constants.%I.facet
  633. // CHECK:STDOUT: %Self.binding.as_type => constants.%X
  634. // CHECK:STDOUT: %pattern_type.loc5_8 => constants.%pattern_type.def
  635. // CHECK:STDOUT: %pattern_type.loc5_20 => constants.%pattern_type.e6836e.2
  636. // CHECK:STDOUT: }
  637. // CHECK:STDOUT: