call.carbon 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  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/function/generic/call.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/generic/call.carbon
  12. // --- explicit.carbon
  13. library "[[@TEST_NAME]]";
  14. //@dump-sem-ir-begin
  15. fn Function(T:! Core.Copy, x: T) -> T {
  16. return x;
  17. }
  18. //@dump-sem-ir-end
  19. fn CallGeneric(T:! Core.Copy, x: T) -> T {
  20. //@dump-sem-ir-begin
  21. return Function(T, x);
  22. //@dump-sem-ir-end
  23. }
  24. fn CallGenericPtr(T:! type, x: T*) -> T* {
  25. //@dump-sem-ir-begin
  26. return Function(T*, x);
  27. //@dump-sem-ir-end
  28. }
  29. class C {}
  30. fn CallSpecific(x: C*) -> C* {
  31. //@dump-sem-ir-begin
  32. return Function(C*, x);
  33. //@dump-sem-ir-end
  34. }
  35. // --- deduced.carbon
  36. library "[[@TEST_NAME]]";
  37. //@dump-sem-ir-begin
  38. fn Function[T:! Core.Copy](x: T) -> T {
  39. return x;
  40. }
  41. //@dump-sem-ir-end
  42. fn CallGeneric(T:! Core.Copy, x: T) -> T {
  43. //@dump-sem-ir-begin
  44. return Function(x);
  45. //@dump-sem-ir-end
  46. }
  47. fn CallGenericPtr(T:! type, x: T*) -> T* {
  48. //@dump-sem-ir-begin
  49. return Function(x);
  50. //@dump-sem-ir-end
  51. }
  52. class C {}
  53. fn CallSpecific(x: C*) -> C* {
  54. //@dump-sem-ir-begin
  55. return Function(x);
  56. //@dump-sem-ir-end
  57. }
  58. // CHECK:STDOUT: --- explicit.carbon
  59. // CHECK:STDOUT:
  60. // CHECK:STDOUT: constants {
  61. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  62. // CHECK:STDOUT: %pattern_type.ce2: type = pattern_type %Copy.type [concrete]
  63. // CHECK:STDOUT: %T.035: %Copy.type = symbolic_binding T, 0 [symbolic]
  64. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.035 [symbolic]
  65. // CHECK:STDOUT: %pattern_type.9b9f0c.2: type = pattern_type %T.binding.as_type [symbolic]
  66. // CHECK:STDOUT: %.076a48.2: Core.Form = init_form %T.binding.as_type [symbolic]
  67. // CHECK:STDOUT: %Function.type: type = fn_type @Function [concrete]
  68. // CHECK:STDOUT: %Function: %Function.type = struct_value () [concrete]
  69. // CHECK:STDOUT: %require_complete.67c: <witness> = require_complete_type %T.binding.as_type [symbolic]
  70. // CHECK:STDOUT: %Copy.lookup_impl_witness.58d: <witness> = lookup_impl_witness %T.035, @Copy [symbolic]
  71. // CHECK:STDOUT: %Copy.WithSelf.Op.type.735e75.2: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%T.035) [symbolic]
  72. // CHECK:STDOUT: %.023: type = fn_type_with_self_type %Copy.WithSelf.Op.type.735e75.2, %T.035 [symbolic]
  73. // CHECK:STDOUT: %impl.elem0.594: %.023 = impl_witness_access %Copy.lookup_impl_witness.58d, element0 [symbolic]
  74. // CHECK:STDOUT: %specific_impl_fn.bdc: <specific function> = specific_impl_function %impl.elem0.594, @Copy.WithSelf.Op(%T.035) [symbolic]
  75. // CHECK:STDOUT: %T.67d: type = symbolic_binding T, 0 [symbolic]
  76. // CHECK:STDOUT: %ptr.e8f: type = ptr_type %T.67d [symbolic]
  77. // CHECK:STDOUT: %require_complete.ef1: <witness> = require_complete_type %ptr.e8f [symbolic]
  78. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.2d4: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%T.67d) [symbolic]
  79. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.74e: %ptr.as.Copy.impl.Op.type.2d4 = struct_value () [symbolic]
  80. // CHECK:STDOUT: %pattern_type.4f4: type = pattern_type %ptr.e8f [symbolic]
  81. // CHECK:STDOUT: %.cb6: Core.Form = init_form %ptr.e8f [symbolic]
  82. // CHECK:STDOUT: %Function.specific_fn.a87: <specific function> = specific_function %Function, @Function(%T.035) [symbolic]
  83. // CHECK:STDOUT: %Copy.lookup_impl_witness.2e6: <witness> = lookup_impl_witness %ptr.e8f, @Copy [symbolic]
  84. // CHECK:STDOUT: %.2f2: require_specific_def_type = require_specific_def @ptr.as.Copy.impl(%T.67d) [symbolic]
  85. // CHECK:STDOUT: %Copy.facet.c25: %Copy.type = facet_value %ptr.e8f, (%Copy.lookup_impl_witness.2e6) [symbolic]
  86. // CHECK:STDOUT: %Function.specific_fn.919: <specific function> = specific_function %Function, @Function(%Copy.facet.c25) [symbolic]
  87. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  88. // CHECK:STDOUT: %ptr.31e: type = ptr_type %C [concrete]
  89. // CHECK:STDOUT: %pattern_type.506: type = pattern_type %ptr.31e [concrete]
  90. // CHECK:STDOUT: %.de8: Core.Form = init_form %ptr.31e [concrete]
  91. // CHECK:STDOUT: %Copy.impl_witness.2c7: <witness> = impl_witness imports.%Copy.impl_witness_table.c3a, @ptr.as.Copy.impl(%C) [concrete]
  92. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.411: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%C) [concrete]
  93. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.ed9: %ptr.as.Copy.impl.Op.type.411 = struct_value () [concrete]
  94. // CHECK:STDOUT: %complete_type.17a: <witness> = complete_type_witness %ptr.31e [concrete]
  95. // CHECK:STDOUT: %Copy.facet.a7f: %Copy.type = facet_value %ptr.31e, (%Copy.impl_witness.2c7) [concrete]
  96. // CHECK:STDOUT: %Function.specific_fn.9da: <specific function> = specific_function %Function, @Function(%Copy.facet.a7f) [concrete]
  97. // CHECK:STDOUT: %Copy.WithSelf.Op.type.d82: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet.c25) [symbolic]
  98. // CHECK:STDOUT: %.299: type = fn_type_with_self_type %Copy.WithSelf.Op.type.d82, %Copy.facet.c25 [symbolic]
  99. // CHECK:STDOUT: %impl.elem0.1c7: %.299 = impl_witness_access %Copy.lookup_impl_witness.2e6, element0 [symbolic]
  100. // CHECK:STDOUT: %specific_impl_fn.366: <specific function> = specific_impl_function %impl.elem0.1c7, @Copy.WithSelf.Op(%Copy.facet.c25) [symbolic]
  101. // CHECK:STDOUT: %Copy.WithSelf.Op.type.259: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet.a7f) [concrete]
  102. // CHECK:STDOUT: %.64b: type = fn_type_with_self_type %Copy.WithSelf.Op.type.259, %Copy.facet.a7f [concrete]
  103. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %ptr.as.Copy.impl.Op.ed9, @ptr.as.Copy.impl.Op(%C) [concrete]
  104. // CHECK:STDOUT: }
  105. // CHECK:STDOUT:
  106. // CHECK:STDOUT: imports {
  107. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  108. // CHECK:STDOUT: .Copy = %Core.Copy
  109. // CHECK:STDOUT: import Core//prelude
  110. // CHECK:STDOUT: import Core//prelude/...
  111. // CHECK:STDOUT: }
  112. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  113. // CHECK:STDOUT: %Core.import_ref.203: @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op.type (%ptr.as.Copy.impl.Op.type.2d4) = import_ref Core//prelude/parts/copy, loc{{\d+_\d+}}, loaded [symbolic = @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op (constants.%ptr.as.Copy.impl.Op.74e)]
  114. // CHECK:STDOUT: %Copy.impl_witness_table.c3a = impl_witness_table (%Core.import_ref.203), @ptr.as.Copy.impl [concrete]
  115. // CHECK:STDOUT: }
  116. // CHECK:STDOUT:
  117. // CHECK:STDOUT: file {
  118. // CHECK:STDOUT: %Function.decl: %Function.type = fn_decl @Function [concrete = constants.%Function] {
  119. // CHECK:STDOUT: %T.patt: %pattern_type.ce2 = symbolic_binding_pattern T, 0 [concrete]
  120. // CHECK:STDOUT: %x.param_patt: @Function.%pattern_type (%pattern_type.9b9f0c.2) = value_param_pattern [concrete]
  121. // CHECK:STDOUT: %x.patt: @Function.%pattern_type (%pattern_type.9b9f0c.2) = at_binding_pattern x, %x.param_patt [concrete]
  122. // CHECK:STDOUT: %return.param_patt: @Function.%pattern_type (%pattern_type.9b9f0c.2) = out_param_pattern [concrete]
  123. // CHECK:STDOUT: %return.patt: @Function.%pattern_type (%pattern_type.9b9f0c.2) = return_slot_pattern %return.param_patt, %.loc5_37.3 [concrete]
  124. // CHECK:STDOUT: } {
  125. // CHECK:STDOUT: %T.ref.loc5_37: %Copy.type = name_ref T, %T.loc5_14.2 [symbolic = %T.loc5_14.1 (constants.%T.035)]
  126. // CHECK:STDOUT: %T.as_type.loc5_37: type = facet_access_type %T.ref.loc5_37 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  127. // CHECK:STDOUT: %.loc5_37.3: type = converted %T.ref.loc5_37, %T.as_type.loc5_37 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  128. // CHECK:STDOUT: %.loc5_37.4: Core.Form = init_form %.loc5_37.3 [symbolic = %.loc5_37.2 (constants.%.076a48.2)]
  129. // CHECK:STDOUT: %.loc5_21: type = splice_block %Copy.ref [concrete = constants.%Copy.type] {
  130. // CHECK:STDOUT: <elided>
  131. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
  132. // CHECK:STDOUT: %Copy.ref: type = name_ref Copy, imports.%Core.Copy [concrete = constants.%Copy.type]
  133. // CHECK:STDOUT: }
  134. // CHECK:STDOUT: %T.loc5_14.2: %Copy.type = symbolic_binding T, 0 [symbolic = %T.loc5_14.1 (constants.%T.035)]
  135. // CHECK:STDOUT: %x.param: @Function.%T.binding.as_type (%T.binding.as_type) = value_param call_param0
  136. // CHECK:STDOUT: %.loc5_31.1: type = splice_block %.loc5_31.2 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] {
  137. // CHECK:STDOUT: %T.ref.loc5_31: %Copy.type = name_ref T, %T.loc5_14.2 [symbolic = %T.loc5_14.1 (constants.%T.035)]
  138. // CHECK:STDOUT: %T.as_type.loc5_31: type = facet_access_type %T.ref.loc5_31 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  139. // CHECK:STDOUT: %.loc5_31.2: type = converted %T.ref.loc5_31, %T.as_type.loc5_31 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  140. // CHECK:STDOUT: }
  141. // CHECK:STDOUT: %x: @Function.%T.binding.as_type (%T.binding.as_type) = value_binding x, %x.param
  142. // CHECK:STDOUT: %return.param: ref @Function.%T.binding.as_type (%T.binding.as_type) = out_param call_param1
  143. // CHECK:STDOUT: %return: ref @Function.%T.binding.as_type (%T.binding.as_type) = return_slot %return.param
  144. // CHECK:STDOUT: }
  145. // CHECK:STDOUT: }
  146. // CHECK:STDOUT:
  147. // CHECK:STDOUT: generic fn @Function(%T.loc5_14.2: %Copy.type) {
  148. // CHECK:STDOUT: %T.loc5_14.1: %Copy.type = symbolic_binding T, 0 [symbolic = %T.loc5_14.1 (constants.%T.035)]
  149. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.loc5_14.1 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  150. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.9b9f0c.2)]
  151. // CHECK:STDOUT: %.loc5_37.2: Core.Form = init_form %T.binding.as_type [symbolic = %.loc5_37.2 (constants.%.076a48.2)]
  152. // CHECK:STDOUT:
  153. // CHECK:STDOUT: !definition:
  154. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.binding.as_type [symbolic = %require_complete (constants.%require_complete.67c)]
  155. // CHECK:STDOUT: %Copy.WithSelf.Op.type: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%T.loc5_14.1) [symbolic = %Copy.WithSelf.Op.type (constants.%Copy.WithSelf.Op.type.735e75.2)]
  156. // CHECK:STDOUT: %.loc6: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %T.loc5_14.1 [symbolic = %.loc6 (constants.%.023)]
  157. // CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc5_14.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.58d)]
  158. // CHECK:STDOUT: %impl.elem0.loc6_10.2: @Function.%.loc6 (%.023) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.594)]
  159. // CHECK:STDOUT: %specific_impl_fn.loc6_10.2: <specific function> = specific_impl_function %impl.elem0.loc6_10.2, @Copy.WithSelf.Op(%T.loc5_14.1) [symbolic = %specific_impl_fn.loc6_10.2 (constants.%specific_impl_fn.bdc)]
  160. // CHECK:STDOUT:
  161. // CHECK:STDOUT: fn(%x.param: @Function.%T.binding.as_type (%T.binding.as_type)) -> out %return.param: @Function.%T.binding.as_type (%T.binding.as_type) {
  162. // CHECK:STDOUT: !entry:
  163. // CHECK:STDOUT: %x.ref: @Function.%T.binding.as_type (%T.binding.as_type) = name_ref x, %x
  164. // CHECK:STDOUT: %impl.elem0.loc6_10.1: @Function.%.loc6 (%.023) = impl_witness_access constants.%Copy.lookup_impl_witness.58d, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.594)]
  165. // CHECK:STDOUT: %bound_method.loc6_10.1: <bound method> = bound_method %x.ref, %impl.elem0.loc6_10.1
  166. // CHECK:STDOUT: %specific_impl_fn.loc6_10.1: <specific function> = specific_impl_function %impl.elem0.loc6_10.1, @Copy.WithSelf.Op(constants.%T.035) [symbolic = %specific_impl_fn.loc6_10.2 (constants.%specific_impl_fn.bdc)]
  167. // CHECK:STDOUT: %bound_method.loc6_10.2: <bound method> = bound_method %x.ref, %specific_impl_fn.loc6_10.1
  168. // CHECK:STDOUT: %.loc5_37.1: ref @Function.%T.binding.as_type (%T.binding.as_type) = splice_block %return.param {}
  169. // CHECK:STDOUT: %Copy.WithSelf.Op.call: init @Function.%T.binding.as_type (%T.binding.as_type) to %.loc5_37.1 = call %bound_method.loc6_10.2(%x.ref)
  170. // CHECK:STDOUT: return %Copy.WithSelf.Op.call to %return.param
  171. // CHECK:STDOUT: }
  172. // CHECK:STDOUT: }
  173. // CHECK:STDOUT:
  174. // CHECK:STDOUT: generic fn @CallGeneric(%T.loc10_17.2: %Copy.type) {
  175. // CHECK:STDOUT: <elided>
  176. // CHECK:STDOUT:
  177. // CHECK:STDOUT: !definition:
  178. // CHECK:STDOUT: <elided>
  179. // CHECK:STDOUT: %Function.specific_fn.loc12_10.2: <specific function> = specific_function constants.%Function, @Function(%T.loc10_17.1) [symbolic = %Function.specific_fn.loc12_10.2 (constants.%Function.specific_fn.a87)]
  180. // CHECK:STDOUT:
  181. // CHECK:STDOUT: fn(%x.param: @CallGeneric.%T.binding.as_type (%T.binding.as_type)) -> out %return.param: @CallGeneric.%T.binding.as_type (%T.binding.as_type) {
  182. // CHECK:STDOUT: !entry:
  183. // CHECK:STDOUT: %Function.ref: %Function.type = name_ref Function, file.%Function.decl [concrete = constants.%Function]
  184. // CHECK:STDOUT: %T.ref.loc12: %Copy.type = name_ref T, %T.loc10_17.2 [symbolic = %T.loc10_17.1 (constants.%T.035)]
  185. // CHECK:STDOUT: %x.ref: @CallGeneric.%T.binding.as_type (%T.binding.as_type) = name_ref x, %x
  186. // CHECK:STDOUT: %.loc12: %Copy.type = converted constants.%T.binding.as_type, constants.%T.035 [symbolic = %T.loc10_17.1 (constants.%T.035)]
  187. // CHECK:STDOUT: %Function.specific_fn.loc12_10.1: <specific function> = specific_function %Function.ref, @Function(constants.%T.035) [symbolic = %Function.specific_fn.loc12_10.2 (constants.%Function.specific_fn.a87)]
  188. // CHECK:STDOUT: <elided>
  189. // CHECK:STDOUT: %Function.call: init @CallGeneric.%T.binding.as_type (%T.binding.as_type) to %.loc10_40.1 = call %Function.specific_fn.loc12_10.1(%x.ref)
  190. // CHECK:STDOUT: return %Function.call to %return.param
  191. // CHECK:STDOUT: }
  192. // CHECK:STDOUT: }
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: generic fn @CallGenericPtr(%T.loc16_20.2: type) {
  195. // CHECK:STDOUT: <elided>
  196. // CHECK:STDOUT:
  197. // CHECK:STDOUT: !definition:
  198. // CHECK:STDOUT: <elided>
  199. // CHECK:STDOUT: %.loc18_24.3: require_specific_def_type = require_specific_def @ptr.as.Copy.impl(%T.loc16_20.1) [symbolic = %.loc18_24.3 (constants.%.2f2)]
  200. // CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %ptr.loc16_33.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.2e6)]
  201. // CHECK:STDOUT: %Copy.facet.loc18_24.3: %Copy.type = facet_value %ptr.loc16_33.1, (%Copy.lookup_impl_witness) [symbolic = %Copy.facet.loc18_24.3 (constants.%Copy.facet.c25)]
  202. // CHECK:STDOUT: %Function.specific_fn.loc18_10.2: <specific function> = specific_function constants.%Function, @Function(%Copy.facet.loc18_24.3) [symbolic = %Function.specific_fn.loc18_10.2 (constants.%Function.specific_fn.919)]
  203. // CHECK:STDOUT:
  204. // CHECK:STDOUT: fn(%x.param: @CallGenericPtr.%ptr.loc16_33.1 (%ptr.e8f)) -> out %return.param: @CallGenericPtr.%ptr.loc16_33.1 (%ptr.e8f) {
  205. // CHECK:STDOUT: !entry:
  206. // CHECK:STDOUT: %Function.ref: %Function.type = name_ref Function, file.%Function.decl [concrete = constants.%Function]
  207. // CHECK:STDOUT: %T.ref.loc18: type = name_ref T, %T.loc16_20.2 [symbolic = %T.loc16_20.1 (constants.%T.67d)]
  208. // CHECK:STDOUT: %ptr.loc18: type = ptr_type %T.ref.loc18 [symbolic = %ptr.loc16_33.1 (constants.%ptr.e8f)]
  209. // CHECK:STDOUT: %x.ref: @CallGenericPtr.%ptr.loc16_33.1 (%ptr.e8f) = name_ref x, %x
  210. // CHECK:STDOUT: %Copy.facet.loc18_24.1: %Copy.type = facet_value %ptr.loc18, (constants.%Copy.lookup_impl_witness.2e6) [symbolic = %Copy.facet.loc18_24.3 (constants.%Copy.facet.c25)]
  211. // CHECK:STDOUT: %.loc18_24.1: %Copy.type = converted %ptr.loc18, %Copy.facet.loc18_24.1 [symbolic = %Copy.facet.loc18_24.3 (constants.%Copy.facet.c25)]
  212. // CHECK:STDOUT: %Copy.facet.loc18_24.2: %Copy.type = facet_value constants.%ptr.e8f, (constants.%Copy.lookup_impl_witness.2e6) [symbolic = %Copy.facet.loc18_24.3 (constants.%Copy.facet.c25)]
  213. // CHECK:STDOUT: %.loc18_24.2: %Copy.type = converted constants.%ptr.e8f, %Copy.facet.loc18_24.2 [symbolic = %Copy.facet.loc18_24.3 (constants.%Copy.facet.c25)]
  214. // CHECK:STDOUT: %Function.specific_fn.loc18_10.1: <specific function> = specific_function %Function.ref, @Function(constants.%Copy.facet.c25) [symbolic = %Function.specific_fn.loc18_10.2 (constants.%Function.specific_fn.919)]
  215. // CHECK:STDOUT: %Function.call: init @CallGenericPtr.%ptr.loc16_33.1 (%ptr.e8f) = call %Function.specific_fn.loc18_10.1(%x.ref)
  216. // CHECK:STDOUT: return %Function.call
  217. // CHECK:STDOUT: }
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: fn @CallSpecific(%x.param: %ptr.31e) -> out %return.param: %ptr.31e {
  221. // CHECK:STDOUT: !entry:
  222. // CHECK:STDOUT: %Function.ref: %Function.type = name_ref Function, file.%Function.decl [concrete = constants.%Function]
  223. // CHECK:STDOUT: %C.ref.loc26: type = name_ref C, file.%C.decl [concrete = constants.%C]
  224. // CHECK:STDOUT: %ptr.loc26: type = ptr_type %C.ref.loc26 [concrete = constants.%ptr.31e]
  225. // CHECK:STDOUT: %x.ref: %ptr.31e = name_ref x, %x
  226. // CHECK:STDOUT: %Copy.facet.loc26_24.1: %Copy.type = facet_value %ptr.loc26, (constants.%Copy.impl_witness.2c7) [concrete = constants.%Copy.facet.a7f]
  227. // CHECK:STDOUT: %.loc26_24.1: %Copy.type = converted %ptr.loc26, %Copy.facet.loc26_24.1 [concrete = constants.%Copy.facet.a7f]
  228. // CHECK:STDOUT: %Copy.facet.loc26_24.2: %Copy.type = facet_value constants.%ptr.31e, (constants.%Copy.impl_witness.2c7) [concrete = constants.%Copy.facet.a7f]
  229. // CHECK:STDOUT: %.loc26_24.2: %Copy.type = converted constants.%ptr.31e, %Copy.facet.loc26_24.2 [concrete = constants.%Copy.facet.a7f]
  230. // CHECK:STDOUT: %Function.specific_fn: <specific function> = specific_function %Function.ref, @Function(constants.%Copy.facet.a7f) [concrete = constants.%Function.specific_fn.9da]
  231. // CHECK:STDOUT: %Function.call: init %ptr.31e = call %Function.specific_fn(%x.ref)
  232. // CHECK:STDOUT: return %Function.call
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT:
  235. // CHECK:STDOUT: specific @Function(constants.%T.035) {
  236. // CHECK:STDOUT: %T.loc5_14.1 => constants.%T.035
  237. // CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type
  238. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.9b9f0c.2
  239. // CHECK:STDOUT: %.loc5_37.2 => constants.%.076a48.2
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: !definition:
  242. // CHECK:STDOUT: %require_complete => constants.%require_complete.67c
  243. // CHECK:STDOUT: %Copy.WithSelf.Op.type => constants.%Copy.WithSelf.Op.type.735e75.2
  244. // CHECK:STDOUT: %.loc6 => constants.%.023
  245. // CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.lookup_impl_witness.58d
  246. // CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%impl.elem0.594
  247. // CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%specific_impl_fn.bdc
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: specific @CallGeneric(constants.%T.035) {
  251. // CHECK:STDOUT: %T.loc10_17.1 => constants.%T.035
  252. // CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type
  253. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.9b9f0c.2
  254. // CHECK:STDOUT: %.loc10_40.2 => constants.%.076a48.2
  255. // CHECK:STDOUT: }
  256. // CHECK:STDOUT:
  257. // CHECK:STDOUT: specific @CallGenericPtr(constants.%T.67d) {
  258. // CHECK:STDOUT: %T.loc16_20.1 => constants.%T.67d
  259. // CHECK:STDOUT: %ptr.loc16_33.1 => constants.%ptr.e8f
  260. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.4f4
  261. // CHECK:STDOUT: %.loc16_40.1 => constants.%.cb6
  262. // CHECK:STDOUT: }
  263. // CHECK:STDOUT:
  264. // CHECK:STDOUT: specific @Function(constants.%Copy.facet.c25) {
  265. // CHECK:STDOUT: %T.loc5_14.1 => constants.%Copy.facet.c25
  266. // CHECK:STDOUT: %T.binding.as_type => constants.%ptr.e8f
  267. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.4f4
  268. // CHECK:STDOUT: %.loc5_37.2 => constants.%.cb6
  269. // CHECK:STDOUT:
  270. // CHECK:STDOUT: !definition:
  271. // CHECK:STDOUT: %require_complete => constants.%require_complete.ef1
  272. // CHECK:STDOUT: %Copy.WithSelf.Op.type => constants.%Copy.WithSelf.Op.type.d82
  273. // CHECK:STDOUT: %.loc6 => constants.%.299
  274. // CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.lookup_impl_witness.2e6
  275. // CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%impl.elem0.1c7
  276. // CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%specific_impl_fn.366
  277. // CHECK:STDOUT: }
  278. // CHECK:STDOUT:
  279. // CHECK:STDOUT: specific @Function(constants.%Copy.facet.a7f) {
  280. // CHECK:STDOUT: %T.loc5_14.1 => constants.%Copy.facet.a7f
  281. // CHECK:STDOUT: %T.binding.as_type => constants.%ptr.31e
  282. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.506
  283. // CHECK:STDOUT: %.loc5_37.2 => constants.%.de8
  284. // CHECK:STDOUT:
  285. // CHECK:STDOUT: !definition:
  286. // CHECK:STDOUT: %require_complete => constants.%complete_type.17a
  287. // CHECK:STDOUT: %Copy.WithSelf.Op.type => constants.%Copy.WithSelf.Op.type.259
  288. // CHECK:STDOUT: %.loc6 => constants.%.64b
  289. // CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.impl_witness.2c7
  290. // CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%ptr.as.Copy.impl.Op.ed9
  291. // CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%ptr.as.Copy.impl.Op.specific_fn
  292. // CHECK:STDOUT: }
  293. // CHECK:STDOUT:
  294. // CHECK:STDOUT: --- deduced.carbon
  295. // CHECK:STDOUT:
  296. // CHECK:STDOUT: constants {
  297. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  298. // CHECK:STDOUT: %pattern_type.ce2: type = pattern_type %Copy.type [concrete]
  299. // CHECK:STDOUT: %T.035: %Copy.type = symbolic_binding T, 0 [symbolic]
  300. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.035 [symbolic]
  301. // CHECK:STDOUT: %pattern_type.9b9f0c.2: type = pattern_type %T.binding.as_type [symbolic]
  302. // CHECK:STDOUT: %.076a48.2: Core.Form = init_form %T.binding.as_type [symbolic]
  303. // CHECK:STDOUT: %Function.type: type = fn_type @Function [concrete]
  304. // CHECK:STDOUT: %Function: %Function.type = struct_value () [concrete]
  305. // CHECK:STDOUT: %require_complete.67c: <witness> = require_complete_type %T.binding.as_type [symbolic]
  306. // CHECK:STDOUT: %Copy.lookup_impl_witness.58d: <witness> = lookup_impl_witness %T.035, @Copy [symbolic]
  307. // CHECK:STDOUT: %Copy.WithSelf.Op.type.735e75.2: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%T.035) [symbolic]
  308. // CHECK:STDOUT: %.023: type = fn_type_with_self_type %Copy.WithSelf.Op.type.735e75.2, %T.035 [symbolic]
  309. // CHECK:STDOUT: %impl.elem0.594: %.023 = impl_witness_access %Copy.lookup_impl_witness.58d, element0 [symbolic]
  310. // CHECK:STDOUT: %specific_impl_fn.bdc: <specific function> = specific_impl_function %impl.elem0.594, @Copy.WithSelf.Op(%T.035) [symbolic]
  311. // CHECK:STDOUT: %T.67d: type = symbolic_binding T, 0 [symbolic]
  312. // CHECK:STDOUT: %ptr.e8f: type = ptr_type %T.67d [symbolic]
  313. // CHECK:STDOUT: %require_complete.ef1: <witness> = require_complete_type %ptr.e8f [symbolic]
  314. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.2d4: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%T.67d) [symbolic]
  315. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.74e: %ptr.as.Copy.impl.Op.type.2d4 = struct_value () [symbolic]
  316. // CHECK:STDOUT: %pattern_type.4f4: type = pattern_type %ptr.e8f [symbolic]
  317. // CHECK:STDOUT: %.cb6: Core.Form = init_form %ptr.e8f [symbolic]
  318. // CHECK:STDOUT: %Function.specific_fn.a87: <specific function> = specific_function %Function, @Function(%T.035) [symbolic]
  319. // CHECK:STDOUT: %Copy.lookup_impl_witness.2e6: <witness> = lookup_impl_witness %ptr.e8f, @Copy [symbolic]
  320. // CHECK:STDOUT: %.2f2: require_specific_def_type = require_specific_def @ptr.as.Copy.impl(%T.67d) [symbolic]
  321. // CHECK:STDOUT: %Copy.facet.c25: %Copy.type = facet_value %ptr.e8f, (%Copy.lookup_impl_witness.2e6) [symbolic]
  322. // CHECK:STDOUT: %Function.specific_fn.919: <specific function> = specific_function %Function, @Function(%Copy.facet.c25) [symbolic]
  323. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  324. // CHECK:STDOUT: %ptr.31e: type = ptr_type %C [concrete]
  325. // CHECK:STDOUT: %pattern_type.506: type = pattern_type %ptr.31e [concrete]
  326. // CHECK:STDOUT: %.de8: Core.Form = init_form %ptr.31e [concrete]
  327. // CHECK:STDOUT: %Copy.impl_witness.2c7: <witness> = impl_witness imports.%Copy.impl_witness_table.c3a, @ptr.as.Copy.impl(%C) [concrete]
  328. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.type.411: type = fn_type @ptr.as.Copy.impl.Op, @ptr.as.Copy.impl(%C) [concrete]
  329. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.ed9: %ptr.as.Copy.impl.Op.type.411 = struct_value () [concrete]
  330. // CHECK:STDOUT: %complete_type.17a: <witness> = complete_type_witness %ptr.31e [concrete]
  331. // CHECK:STDOUT: %Copy.facet.a7f: %Copy.type = facet_value %ptr.31e, (%Copy.impl_witness.2c7) [concrete]
  332. // CHECK:STDOUT: %Function.specific_fn.9da: <specific function> = specific_function %Function, @Function(%Copy.facet.a7f) [concrete]
  333. // CHECK:STDOUT: %Copy.WithSelf.Op.type.d82: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet.c25) [symbolic]
  334. // CHECK:STDOUT: %.299: type = fn_type_with_self_type %Copy.WithSelf.Op.type.d82, %Copy.facet.c25 [symbolic]
  335. // CHECK:STDOUT: %impl.elem0.1c7: %.299 = impl_witness_access %Copy.lookup_impl_witness.2e6, element0 [symbolic]
  336. // CHECK:STDOUT: %specific_impl_fn.366: <specific function> = specific_impl_function %impl.elem0.1c7, @Copy.WithSelf.Op(%Copy.facet.c25) [symbolic]
  337. // CHECK:STDOUT: %Copy.WithSelf.Op.type.259: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet.a7f) [concrete]
  338. // CHECK:STDOUT: %.64b: type = fn_type_with_self_type %Copy.WithSelf.Op.type.259, %Copy.facet.a7f [concrete]
  339. // CHECK:STDOUT: %ptr.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %ptr.as.Copy.impl.Op.ed9, @ptr.as.Copy.impl.Op(%C) [concrete]
  340. // CHECK:STDOUT: }
  341. // CHECK:STDOUT:
  342. // CHECK:STDOUT: imports {
  343. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  344. // CHECK:STDOUT: .Copy = %Core.Copy
  345. // CHECK:STDOUT: import Core//prelude
  346. // CHECK:STDOUT: import Core//prelude/...
  347. // CHECK:STDOUT: }
  348. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  349. // CHECK:STDOUT: %Core.import_ref.203: @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op.type (%ptr.as.Copy.impl.Op.type.2d4) = import_ref Core//prelude/parts/copy, loc{{\d+_\d+}}, loaded [symbolic = @ptr.as.Copy.impl.%ptr.as.Copy.impl.Op (constants.%ptr.as.Copy.impl.Op.74e)]
  350. // CHECK:STDOUT: %Copy.impl_witness_table.c3a = impl_witness_table (%Core.import_ref.203), @ptr.as.Copy.impl [concrete]
  351. // CHECK:STDOUT: }
  352. // CHECK:STDOUT:
  353. // CHECK:STDOUT: file {
  354. // CHECK:STDOUT: %Function.decl: %Function.type = fn_decl @Function [concrete = constants.%Function] {
  355. // CHECK:STDOUT: %T.patt: %pattern_type.ce2 = symbolic_binding_pattern T, 0 [concrete]
  356. // CHECK:STDOUT: %x.param_patt: @Function.%pattern_type (%pattern_type.9b9f0c.2) = value_param_pattern [concrete]
  357. // CHECK:STDOUT: %x.patt: @Function.%pattern_type (%pattern_type.9b9f0c.2) = at_binding_pattern x, %x.param_patt [concrete]
  358. // CHECK:STDOUT: %return.param_patt: @Function.%pattern_type (%pattern_type.9b9f0c.2) = out_param_pattern [concrete]
  359. // CHECK:STDOUT: %return.patt: @Function.%pattern_type (%pattern_type.9b9f0c.2) = return_slot_pattern %return.param_patt, %.loc5_37.3 [concrete]
  360. // CHECK:STDOUT: } {
  361. // CHECK:STDOUT: %T.ref.loc5_37: %Copy.type = name_ref T, %T.loc5_14.2 [symbolic = %T.loc5_14.1 (constants.%T.035)]
  362. // CHECK:STDOUT: %T.as_type.loc5_37: type = facet_access_type %T.ref.loc5_37 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  363. // CHECK:STDOUT: %.loc5_37.3: type = converted %T.ref.loc5_37, %T.as_type.loc5_37 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  364. // CHECK:STDOUT: %.loc5_37.4: Core.Form = init_form %.loc5_37.3 [symbolic = %.loc5_37.2 (constants.%.076a48.2)]
  365. // CHECK:STDOUT: %.loc5_21: type = splice_block %Copy.ref [concrete = constants.%Copy.type] {
  366. // CHECK:STDOUT: <elided>
  367. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
  368. // CHECK:STDOUT: %Copy.ref: type = name_ref Copy, imports.%Core.Copy [concrete = constants.%Copy.type]
  369. // CHECK:STDOUT: }
  370. // CHECK:STDOUT: %T.loc5_14.2: %Copy.type = symbolic_binding T, 0 [symbolic = %T.loc5_14.1 (constants.%T.035)]
  371. // CHECK:STDOUT: %x.param: @Function.%T.binding.as_type (%T.binding.as_type) = value_param call_param0
  372. // CHECK:STDOUT: %.loc5_31.1: type = splice_block %.loc5_31.2 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] {
  373. // CHECK:STDOUT: %T.ref.loc5_31: %Copy.type = name_ref T, %T.loc5_14.2 [symbolic = %T.loc5_14.1 (constants.%T.035)]
  374. // CHECK:STDOUT: %T.as_type.loc5_31: type = facet_access_type %T.ref.loc5_31 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  375. // CHECK:STDOUT: %.loc5_31.2: type = converted %T.ref.loc5_31, %T.as_type.loc5_31 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  376. // CHECK:STDOUT: }
  377. // CHECK:STDOUT: %x: @Function.%T.binding.as_type (%T.binding.as_type) = value_binding x, %x.param
  378. // CHECK:STDOUT: %return.param: ref @Function.%T.binding.as_type (%T.binding.as_type) = out_param call_param1
  379. // CHECK:STDOUT: %return: ref @Function.%T.binding.as_type (%T.binding.as_type) = return_slot %return.param
  380. // CHECK:STDOUT: }
  381. // CHECK:STDOUT: }
  382. // CHECK:STDOUT:
  383. // CHECK:STDOUT: generic fn @Function(%T.loc5_14.2: %Copy.type) {
  384. // CHECK:STDOUT: %T.loc5_14.1: %Copy.type = symbolic_binding T, 0 [symbolic = %T.loc5_14.1 (constants.%T.035)]
  385. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.loc5_14.1 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  386. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.9b9f0c.2)]
  387. // CHECK:STDOUT: %.loc5_37.2: Core.Form = init_form %T.binding.as_type [symbolic = %.loc5_37.2 (constants.%.076a48.2)]
  388. // CHECK:STDOUT:
  389. // CHECK:STDOUT: !definition:
  390. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.binding.as_type [symbolic = %require_complete (constants.%require_complete.67c)]
  391. // CHECK:STDOUT: %Copy.WithSelf.Op.type: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%T.loc5_14.1) [symbolic = %Copy.WithSelf.Op.type (constants.%Copy.WithSelf.Op.type.735e75.2)]
  392. // CHECK:STDOUT: %.loc6: type = fn_type_with_self_type %Copy.WithSelf.Op.type, %T.loc5_14.1 [symbolic = %.loc6 (constants.%.023)]
  393. // CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc5_14.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.58d)]
  394. // CHECK:STDOUT: %impl.elem0.loc6_10.2: @Function.%.loc6 (%.023) = impl_witness_access %Copy.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.594)]
  395. // CHECK:STDOUT: %specific_impl_fn.loc6_10.2: <specific function> = specific_impl_function %impl.elem0.loc6_10.2, @Copy.WithSelf.Op(%T.loc5_14.1) [symbolic = %specific_impl_fn.loc6_10.2 (constants.%specific_impl_fn.bdc)]
  396. // CHECK:STDOUT:
  397. // CHECK:STDOUT: fn(%x.param: @Function.%T.binding.as_type (%T.binding.as_type)) -> out %return.param: @Function.%T.binding.as_type (%T.binding.as_type) {
  398. // CHECK:STDOUT: !entry:
  399. // CHECK:STDOUT: %x.ref: @Function.%T.binding.as_type (%T.binding.as_type) = name_ref x, %x
  400. // CHECK:STDOUT: %impl.elem0.loc6_10.1: @Function.%.loc6 (%.023) = impl_witness_access constants.%Copy.lookup_impl_witness.58d, element0 [symbolic = %impl.elem0.loc6_10.2 (constants.%impl.elem0.594)]
  401. // CHECK:STDOUT: %bound_method.loc6_10.1: <bound method> = bound_method %x.ref, %impl.elem0.loc6_10.1
  402. // CHECK:STDOUT: %specific_impl_fn.loc6_10.1: <specific function> = specific_impl_function %impl.elem0.loc6_10.1, @Copy.WithSelf.Op(constants.%T.035) [symbolic = %specific_impl_fn.loc6_10.2 (constants.%specific_impl_fn.bdc)]
  403. // CHECK:STDOUT: %bound_method.loc6_10.2: <bound method> = bound_method %x.ref, %specific_impl_fn.loc6_10.1
  404. // CHECK:STDOUT: %.loc5_37.1: ref @Function.%T.binding.as_type (%T.binding.as_type) = splice_block %return.param {}
  405. // CHECK:STDOUT: %Copy.WithSelf.Op.call: init @Function.%T.binding.as_type (%T.binding.as_type) to %.loc5_37.1 = call %bound_method.loc6_10.2(%x.ref)
  406. // CHECK:STDOUT: return %Copy.WithSelf.Op.call to %return.param
  407. // CHECK:STDOUT: }
  408. // CHECK:STDOUT: }
  409. // CHECK:STDOUT:
  410. // CHECK:STDOUT: generic fn @CallGeneric(%T.loc10_17.2: %Copy.type) {
  411. // CHECK:STDOUT: <elided>
  412. // CHECK:STDOUT:
  413. // CHECK:STDOUT: !definition:
  414. // CHECK:STDOUT: <elided>
  415. // CHECK:STDOUT: %Function.specific_fn.loc12_10.2: <specific function> = specific_function constants.%Function, @Function(%T.loc10_17.1) [symbolic = %Function.specific_fn.loc12_10.2 (constants.%Function.specific_fn.a87)]
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: fn(%x.param: @CallGeneric.%T.binding.as_type (%T.binding.as_type)) -> out %return.param: @CallGeneric.%T.binding.as_type (%T.binding.as_type) {
  418. // CHECK:STDOUT: !entry:
  419. // CHECK:STDOUT: %Function.ref: %Function.type = name_ref Function, file.%Function.decl [concrete = constants.%Function]
  420. // CHECK:STDOUT: %x.ref: @CallGeneric.%T.binding.as_type (%T.binding.as_type) = name_ref x, %x
  421. // CHECK:STDOUT: %.loc12: %Copy.type = converted constants.%T.binding.as_type, constants.%T.035 [symbolic = %T.loc10_17.1 (constants.%T.035)]
  422. // CHECK:STDOUT: %Function.specific_fn.loc12_10.1: <specific function> = specific_function %Function.ref, @Function(constants.%T.035) [symbolic = %Function.specific_fn.loc12_10.2 (constants.%Function.specific_fn.a87)]
  423. // CHECK:STDOUT: <elided>
  424. // CHECK:STDOUT: %Function.call: init @CallGeneric.%T.binding.as_type (%T.binding.as_type) to %.loc10_40.1 = call %Function.specific_fn.loc12_10.1(%x.ref)
  425. // CHECK:STDOUT: return %Function.call to %return.param
  426. // CHECK:STDOUT: }
  427. // CHECK:STDOUT: }
  428. // CHECK:STDOUT:
  429. // CHECK:STDOUT: generic fn @CallGenericPtr(%T.loc16_20.2: type) {
  430. // CHECK:STDOUT: <elided>
  431. // CHECK:STDOUT:
  432. // CHECK:STDOUT: !definition:
  433. // CHECK:STDOUT: <elided>
  434. // CHECK:STDOUT: %.loc18_20.2: require_specific_def_type = require_specific_def @ptr.as.Copy.impl(%T.loc16_20.1) [symbolic = %.loc18_20.2 (constants.%.2f2)]
  435. // CHECK:STDOUT: %Copy.lookup_impl_witness: <witness> = lookup_impl_witness %ptr.loc16_33.1, @Copy [symbolic = %Copy.lookup_impl_witness (constants.%Copy.lookup_impl_witness.2e6)]
  436. // CHECK:STDOUT: %Copy.facet.loc18_20.2: %Copy.type = facet_value %ptr.loc16_33.1, (%Copy.lookup_impl_witness) [symbolic = %Copy.facet.loc18_20.2 (constants.%Copy.facet.c25)]
  437. // CHECK:STDOUT: %Function.specific_fn.loc18_10.2: <specific function> = specific_function constants.%Function, @Function(%Copy.facet.loc18_20.2) [symbolic = %Function.specific_fn.loc18_10.2 (constants.%Function.specific_fn.919)]
  438. // CHECK:STDOUT:
  439. // CHECK:STDOUT: fn(%x.param: @CallGenericPtr.%ptr.loc16_33.1 (%ptr.e8f)) -> out %return.param: @CallGenericPtr.%ptr.loc16_33.1 (%ptr.e8f) {
  440. // CHECK:STDOUT: !entry:
  441. // CHECK:STDOUT: %Function.ref: %Function.type = name_ref Function, file.%Function.decl [concrete = constants.%Function]
  442. // CHECK:STDOUT: %x.ref: @CallGenericPtr.%ptr.loc16_33.1 (%ptr.e8f) = name_ref x, %x
  443. // CHECK:STDOUT: %Copy.facet.loc18_20.1: %Copy.type = facet_value constants.%ptr.e8f, (constants.%Copy.lookup_impl_witness.2e6) [symbolic = %Copy.facet.loc18_20.2 (constants.%Copy.facet.c25)]
  444. // CHECK:STDOUT: %.loc18_20.1: %Copy.type = converted constants.%ptr.e8f, %Copy.facet.loc18_20.1 [symbolic = %Copy.facet.loc18_20.2 (constants.%Copy.facet.c25)]
  445. // CHECK:STDOUT: %Function.specific_fn.loc18_10.1: <specific function> = specific_function %Function.ref, @Function(constants.%Copy.facet.c25) [symbolic = %Function.specific_fn.loc18_10.2 (constants.%Function.specific_fn.919)]
  446. // CHECK:STDOUT: %Function.call: init @CallGenericPtr.%ptr.loc16_33.1 (%ptr.e8f) = call %Function.specific_fn.loc18_10.1(%x.ref)
  447. // CHECK:STDOUT: return %Function.call
  448. // CHECK:STDOUT: }
  449. // CHECK:STDOUT: }
  450. // CHECK:STDOUT:
  451. // CHECK:STDOUT: fn @CallSpecific(%x.param: %ptr.31e) -> out %return.param: %ptr.31e {
  452. // CHECK:STDOUT: !entry:
  453. // CHECK:STDOUT: %Function.ref: %Function.type = name_ref Function, file.%Function.decl [concrete = constants.%Function]
  454. // CHECK:STDOUT: %x.ref: %ptr.31e = name_ref x, %x
  455. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value constants.%ptr.31e, (constants.%Copy.impl_witness.2c7) [concrete = constants.%Copy.facet.a7f]
  456. // CHECK:STDOUT: %.loc26: %Copy.type = converted constants.%ptr.31e, %Copy.facet [concrete = constants.%Copy.facet.a7f]
  457. // CHECK:STDOUT: %Function.specific_fn: <specific function> = specific_function %Function.ref, @Function(constants.%Copy.facet.a7f) [concrete = constants.%Function.specific_fn.9da]
  458. // CHECK:STDOUT: %Function.call: init %ptr.31e = call %Function.specific_fn(%x.ref)
  459. // CHECK:STDOUT: return %Function.call
  460. // CHECK:STDOUT: }
  461. // CHECK:STDOUT:
  462. // CHECK:STDOUT: specific @Function(constants.%T.035) {
  463. // CHECK:STDOUT: %T.loc5_14.1 => constants.%T.035
  464. // CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type
  465. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.9b9f0c.2
  466. // CHECK:STDOUT: %.loc5_37.2 => constants.%.076a48.2
  467. // CHECK:STDOUT:
  468. // CHECK:STDOUT: !definition:
  469. // CHECK:STDOUT: %require_complete => constants.%require_complete.67c
  470. // CHECK:STDOUT: %Copy.WithSelf.Op.type => constants.%Copy.WithSelf.Op.type.735e75.2
  471. // CHECK:STDOUT: %.loc6 => constants.%.023
  472. // CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.lookup_impl_witness.58d
  473. // CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%impl.elem0.594
  474. // CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%specific_impl_fn.bdc
  475. // CHECK:STDOUT: }
  476. // CHECK:STDOUT:
  477. // CHECK:STDOUT: specific @CallGeneric(constants.%T.035) {
  478. // CHECK:STDOUT: %T.loc10_17.1 => constants.%T.035
  479. // CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type
  480. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.9b9f0c.2
  481. // CHECK:STDOUT: %.loc10_40.2 => constants.%.076a48.2
  482. // CHECK:STDOUT: }
  483. // CHECK:STDOUT:
  484. // CHECK:STDOUT: specific @CallGenericPtr(constants.%T.67d) {
  485. // CHECK:STDOUT: %T.loc16_20.1 => constants.%T.67d
  486. // CHECK:STDOUT: %ptr.loc16_33.1 => constants.%ptr.e8f
  487. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.4f4
  488. // CHECK:STDOUT: %.loc16_40.1 => constants.%.cb6
  489. // CHECK:STDOUT: }
  490. // CHECK:STDOUT:
  491. // CHECK:STDOUT: specific @Function(constants.%Copy.facet.c25) {
  492. // CHECK:STDOUT: %T.loc5_14.1 => constants.%Copy.facet.c25
  493. // CHECK:STDOUT: %T.binding.as_type => constants.%ptr.e8f
  494. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.4f4
  495. // CHECK:STDOUT: %.loc5_37.2 => constants.%.cb6
  496. // CHECK:STDOUT:
  497. // CHECK:STDOUT: !definition:
  498. // CHECK:STDOUT: %require_complete => constants.%require_complete.ef1
  499. // CHECK:STDOUT: %Copy.WithSelf.Op.type => constants.%Copy.WithSelf.Op.type.d82
  500. // CHECK:STDOUT: %.loc6 => constants.%.299
  501. // CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.lookup_impl_witness.2e6
  502. // CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%impl.elem0.1c7
  503. // CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%specific_impl_fn.366
  504. // CHECK:STDOUT: }
  505. // CHECK:STDOUT:
  506. // CHECK:STDOUT: specific @Function(constants.%Copy.facet.a7f) {
  507. // CHECK:STDOUT: %T.loc5_14.1 => constants.%Copy.facet.a7f
  508. // CHECK:STDOUT: %T.binding.as_type => constants.%ptr.31e
  509. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.506
  510. // CHECK:STDOUT: %.loc5_37.2 => constants.%.de8
  511. // CHECK:STDOUT:
  512. // CHECK:STDOUT: !definition:
  513. // CHECK:STDOUT: %require_complete => constants.%complete_type.17a
  514. // CHECK:STDOUT: %Copy.WithSelf.Op.type => constants.%Copy.WithSelf.Op.type.259
  515. // CHECK:STDOUT: %.loc6 => constants.%.64b
  516. // CHECK:STDOUT: %Copy.lookup_impl_witness => constants.%Copy.impl_witness.2c7
  517. // CHECK:STDOUT: %impl.elem0.loc6_10.2 => constants.%ptr.as.Copy.impl.Op.ed9
  518. // CHECK:STDOUT: %specific_impl_fn.loc6_10.2 => constants.%ptr.as.Copy.impl.Op.specific_fn
  519. // CHECK:STDOUT: }
  520. // CHECK:STDOUT: